Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { public static Method getPrivateMethod(Object target, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException { Class targetClass = target.getClass(); Method method = targetClass.getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); return method; } }