code: private Object[] convertArguments(Object obj, String methodName, Object[] args)
      {
          for (Method method : obj.getClass().getMethods()) {
              if (method.getName().equalsIgnoreCase(methodName)
                  && (method.getGenericParameterTypes().length == args.length || method.isVarArgs())) {
                  try {
                      return convertArguments(args, method.getGenericParameterTypes(), method.isVarArgs());
                  } catch (Exception e) {
                      // Ignore and try the next method.
                  }
              }
          }
  
          return null;
      }
docs: Converts the given arguments to match a method with the specified name and the same number of formal parameters
  as the number of arguments.
  
  @param obj the object the method is invoked on, used to retrieve the list of available methods
  @param methodName the method we're looking for
  @param args the method arguments
  @return a new array of arguments where some values have been converted to match the formal method parameter
  types, {@code null} if no such method is found