code: private static Object invoke(Object obj, String method, Object... args)
              throws NoSuchMethodException, InvocationTargetException,
              IllegalAccessException {
          Class<?>[] argumentTypes = new Class[args.length];
          for (int i = 0; i < args.length; ++i) {
              argumentTypes[i] = args[i].getClass();
          }
          Method m = obj.getClass().getMethod(method, argumentTypes);
          m.setAccessible(true);
          return m.invoke(obj, args);
      }
docs: Invoke a method using reflection
  @param obj the object whose method should be invoked
  @param method the name of the method to invoke
  @param args the arguments to pass to the method
  @return the method's return value
  @throws NoSuchMethodException if the method was not found
  @throws InvocationTargetException if the method could not be invoked
  @throws IllegalAccessException if the method could not be accessed