code: public static Object[] fixVarArgs(Class<?>[] paramsWithVarArgs, Object[] arguments) {
          int n = paramsWithVarArgs.length;
          return fixVarArgs(n, paramsWithVarArgs[n-1], arguments);
      }
docs: Fixes an arguments array to fit parameter types,
  where the last parameter is an varargs array.
  @param paramsWithVarArgs
  @param arguments
  @return fixed arguments array