private static void wrapVarargParams(Method method, List<Value> args) throws ClassNotLoadedException, InvalidTypeException {
    int argCount = args.size();
    List<Type> paramTypes = method.argumentTypes();
    Type varargType = ContainerUtil.getLastItem(paramTypes);
    if (varargType instanceof ArrayType) {
      int paramCount = paramTypes.size();
      int arraySize = argCount - paramCount + 1;
      ArrayReference argArray = ((ArrayType)varargType).newInstance(arraySize);
      argArray.setValues(0, args, paramCount - 1, arraySize);
      if (paramCount <= argCount) {
        args.subList(paramCount - 1, argCount).clear();
      }
      args.add(argArray);
    }
  }
private static void wrapVarargParams(Method method, List<Value> args)