Here you can find the source of invokeStaticMethod(Class> cls, String methodName, Object... args)
public static Object invokeStaticMethod(Class<?> cls, String methodName, Object... args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static Object invokeStaticMethod(Class<?> cls, String methodName, Object... args) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { int arguments = args.length; Class<?>[] parameterTypes = new Class[arguments]; for (int i = 0; i < arguments; i++) { parameterTypes[i] = args[i].getClass(); }/*from w w w .j a va 2s . c o m*/ Method method = cls.getMethod(methodName, parameterTypes); return method.invoke(null, args); } }