code: public static <T> T create(Class<T> type, Object... args) throws
      NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
          Class<?>[] argumentTypes = new Class<?>[args.length];
          for (int i = 0; i < args.length; i++) {
              argumentTypes[i] = args[i].getClass();
          }
          return type.cast(choose(type.getConstructors(), new ConstructorParameterExtractor<T>(), null, argumentTypes).newInstance(args));
      }
docs: Creates an instance of a given type by choosing the best constructor that matches the given list of arguments.
  
  @param <T> the type of the object to create
  @param type the type of the object to create
  @param args the arguments to pass to the constructor
  @return the object created
  @throws NoSuchMethodException if an appropriate constructor cannot be found
  @throws IllegalAccessException if an appropriate constructor cannot be accessed
  @throws InvocationTargetException if errors occur while invoking the constructor
  @throws InstantiationException if the constructor itself fails in any way