Helper factory to create instances.
Accepts 'int', converts them to BigInteger, and calls the constructor.

@param args as int values
@return instance
499796
public static PolyEquationImpl create(final int ...args)
    {
        BigInteger[] bigints = new BigInteger[args.length];
        for (int i = 0, n = args.length; i < n; i++)
        {
            bigints[i] = BigInteger.valueOf(args[i]);
        }
        return new PolyEquationImpl(bigints);
    }
454677
public static Object toint32(Context cx, Scriptable thisObj, Object[] args,
                                 Function funObj)
    {
        Object arg = (args.length != 0 ? args[0] : Undefined.instance);
        if (arg instanceof Integer)
            return arg;
        return ScriptRuntime.wrapInt(ScriptRuntime.toInt32(arg));
    }
1276479
public static <T> T newInstance(Constructor<T> constructor, Object... args) {
        try {
            return constructor.newInstance(args);
        } catch (Exception e) {
            throw new ClientException(e);
        }
    }
515051
@SuppressWarnings("unchecked")
	private T createInstance(final String className, final Object... arguments) {
		try {
			Class<?> implementation = Class.forName(className, false, classLoader);
			if (service.isAssignableFrom(implementation)) {
				return (T) implementation.getDeclaredConstructor(argumentTypes).newInstance(arguments);
			} else {
				InternalLogger.log(Level.ERROR, "Class '" + className + "' does not implement servcie interface '" + service + "'");
			}
		} catch (ClassNotFoundException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' not found");
		} catch (NoSuchMethodException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' has no matching constructor");
		} catch (InstantiationException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' is not instantiable");
		} catch (IllegalAccessException ex) {
			InternalLogger.log(Level.ERROR, "Constructor of service implementation '" + className + "' is not accessible");
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.ERROR, "Illegal arguments for constructor of service implementation '" + className + "'");
		} catch (InvocationTargetException ex) {
			InternalLogger.log(Level.ERROR, ex.getTargetException(), "Failed creating service implementation '" + className + "'");
		}

		return null;
	}
484770
public Collection<T> createAll(final Object... arguments) {
		Collection<T> instances = new ArrayList<T>(classes.size());

		for (String className : classes) {
			T instance = createInstance(className, arguments);
			if (instance != null) {
				instances.add(instance);
			}
		}

		return instances;
	}
1075736
public static Object callConstructor(final Class<?> cls, final Object... args) {
    return callConstructor(cls, getTypes(args), args);
  }
620941
public static BeanCodeGen createFromArgs(String[] args) {
        if (args == null) {
            throw new IllegalArgumentException("Arguments must not be null");
        }
        String indent = "    ";
        String prefix = "";
        String defaultStyle = null;
        boolean recurse = false;
        int verbosity = 1;
        boolean write = true;
        File file = null;
        BeanGenConfig config = null;
        if (args.length == 0) {
            throw new IllegalArgumentException("No arguments specified");
        }
        for (int i = 0; i < args.length - 1; i++) {
            String arg = args[i];
            if (arg == null) {
                throw new IllegalArgumentException("Argument must not be null: " + Arrays.toString(args));
            }
            if (arg.startsWith("-indent=tab")) {
                indent = "\t";
            } else if (arg.startsWith("-indent=")) {
                indent = "          ".substring(0, Integer.parseInt(arg.substring(8)));
            } else if (arg.startsWith("-prefix=")) {
                prefix = arg.substring(8);
            } else if (arg.equals("-R")) {
                recurse = true;
            } else if (arg.startsWith("-config=")) {
                if (config != null) {
                    throw new IllegalArgumentException("Argument 'config' must not be specified twice: " + Arrays.toString(args));
                }
                config = BeanGenConfig.parse(arg.substring(8));
            } else if (arg.startsWith("-style=")) {
                if (defaultStyle != null) {
                    throw new IllegalArgumentException("Argument 'style' must not be specified twice: " + Arrays.toString(args));
                }
                defaultStyle = arg.substring(7);
            } else if (arg.startsWith("-verbose=")) {
                verbosity = Integer.parseInt(arg.substring(9));
            } else if (arg.startsWith("-v=")) {
                System.out.println("Deprecated command line argument -v (use -verbose instead)");
                verbosity = Integer.parseInt(arg.substring(3));
            } else if (arg.equals("-nowrite")) {
                write = false;
            } else {
                throw new IllegalArgumentException("Unknown argument: " + arg);
            }
        }
        file = new File(args[args.length - 1]);
        List<File> files = findFiles(file, recurse);
        
        if (config == null) {
            config = BeanGenConfig.parse("guava");
        }
        config.setIndent(indent);
        config.setPrefix(prefix);
        if (defaultStyle != null) {
            config.setDefaultStyle(defaultStyle);
        }
        return new BeanCodeGen(files, config, verbosity, write);
    }
1300898
public static <T> T newInstanceWithArgs(Class<T> clazz, Class<?>[] argTypes, Object[] args)
        throws SofaRpcRuntimeException {
        if (CommonUtils.isEmpty(argTypes)) {
            return newInstance(clazz);
        }
        try {
            if (!(clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers()))) {
                Constructor<T> constructor = clazz.getDeclaredConstructor(argTypes);
                constructor.setAccessible(true);
                return constructor.newInstance(args);
            } else {
                Constructor<T>[] constructors = (Constructor<T>[]) clazz.getDeclaredConstructors();
                if (constructors == null || constructors.length == 0) {
                    throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
                        + " has no constructor with argTypes :" + Arrays.toString(argTypes));
                }
                Constructor<T> constructor = null;
                for (Constructor<T> c : constructors) {
                    Class[] ps = c.getParameterTypes();
                    if (ps.length == argTypes.length + 1) { // 长度多一
                        boolean allMath = true;
                        for (int i = 1; i < ps.length; i++) { // 而且第二个开始的参数类型匹配
                            if (ps[i] != argTypes[i - 1]) {
                                allMath = false;
                                break;
                            }
                        }
                        if (allMath) {
                            constructor = c;
                            break;
                        }
                    }
                }
                if (constructor == null) {
                    throw new SofaRpcRuntimeException("The " + clazz.getCanonicalName()
                        + " has no constructor with argTypes :" + Arrays.toString(argTypes));
                } else {
                    constructor.setAccessible(true);
                    Object[] newArgs = new Object[args.length + 1];
                    System.arraycopy(args, 0, newArgs, 1, args.length);
                    return constructor.newInstance(newArgs);
                }
            }
        } catch (SofaRpcRuntimeException e) {
            throw e;
        } catch (Throwable e) {
            throw new SofaRpcRuntimeException(e.getMessage(), e);
        }
    }
368420
public static <K> NumberMap<K, BigInteger> newBigIntegerMap() {
		return new NumberMap<K, BigInteger>() {
			@Override
			public void add(K key, BigInteger addend) {
				put(key, containsKey(key) ? get(key).add(addend) : addend);
			}
			@Override
			public void sub(K key, BigInteger subtrahend) {
				put(key, (containsKey(key) ? get(key) : BigInteger.ZERO).subtract(subtrahend));
			}
		};
	}
1332795
private Object createInstance(Class pClass, Object pParam) {
    Object value;

    try {

      // Create param and argument arrays
      Class[]  param = { pParam.getClass() };
      Object[] arg   = { pParam };

      // Get constructor
      Constructor constructor = pClass.getDeclaredConstructor(param);

      // Invoke and create instance
      value = constructor.newInstance(arg);
    } catch (Exception e) {
      return null;
    }
    return value;
  }
303036
public static void main(String[] args) {
    System.exit(getConf(
        ClientContext.create(new InstancedConfiguration(ConfigurationUtils.defaults())), args));
  }
573659
public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) {
        if (target == null) {
            throw new IllegalArgumentException();
        }
        addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition,
                RegisterSpecList.EMPTY, catches, constructor.declaringType.constant));
        moveResult(target, true);
        invokeDirect(constructor, null, target, args);
    }
955966
@SuppressWarnings("unused")
	public static void main(String[] args) {
		if (false) {
			long capacity = 1;
			int count = 1;
			while (capacity < Integer.MAX_VALUE) {
				capacity = java.math.BigInteger.valueOf(capacity).nextProbablePrime().longValue();
				System.out.print(capacity + ", ");
				final double inc = Math.log(2) / Math.log(capacity << 5) * 10 + 1;
				// System.out.println(inc);
				capacity *= inc;
				if (count % 5 == 0) {
					System.out.println();
				}
				count++;
			}
			System.out.println(Integer.MAX_VALUE);
			System.out.println("------");

			System.out.println(count);
			System.out.println(PrimeFinder.nextPrime((int) 1e6));
		}
		if (true) {
			IntHashMap<Integer> hash = new IntHashMap<Integer>(16, Integer.class);
			hash.put(1, 2);
			hash.put(2, 4);
			for (Integer i : hash.getValues()) {
				System.out.println(i);
			}
		}
	}
590072
public static <S> PAreaBIGenerator<S> create()
  {
    return new PAreaBIGenerator<>(new Generator<BigInteger>()
    {
      private final Random random = new Random();

      @Override
      public BigInteger next()
      {
        return BigInteger.valueOf(Math.abs(this.random.nextLong()));
      }
    });
  }
248488
@Override
	public T create()
	{
		try
		{
			T obj = ClassPath.newInstance(creationClass);
			
			//Copy prototype properties
			if(this.prototype != null)
				JavaBean.populate(JavaBean.toMap(prototype), obj);
			
			PropertyDescriptor pd = null;
			Class<?> clz = null;
			
			final boolean throwExceptionForMissingProperty = false;
			
			for (String property : randomizeProperties)
			{
				try
				{
					pd = JavaBean.getPropertyDescriptor(obj, property);
					clz = pd.getPropertyType();
					
					if(clz.isAssignableFrom(Class.class) || clz.isEnum())
						continue;
					
					if(clz.isAssignableFrom(String.class))
					{
						try
						{
							JavaBean.setProperty(obj, property, Text.generateId(),throwExceptionForMissingProperty);  
						}
						catch(IllegalArgumentException e)
						{
							throw new IllegalArgumentException("randomizeProperties:"+randomizeProperties+" invalid property:"+property,e);
						}
						
					}
					else if(clz.isAssignableFrom(Integer.class) || clz.isAssignableFrom(int.class) )
					{
						JavaBean.setProperty(obj, property, digits.generateInteger());
					}
					else if (clz.isAssignableFrom(long.class)  || clz.isAssignableFrom(Long.class))
					{
						JavaBean.setProperty(obj, property, digits.generateLong());
					}
					
					else if (clz.isAssignableFrom(short.class)  || clz.isAssignableFrom(Short.class))
					{
						JavaBean.setProperty(obj, property, digits.generateShort());
					}
					else if (clz.isAssignableFrom(double.class)  || clz.isAssignableFrom(Double.class))
					{
						JavaBean.setProperty(obj, property, digits.generateDouble());
					}
					else if (clz.isAssignableFrom(char.class)  || clz.isAssignableFrom(Character.class))
					{
						JavaBean.setProperty(obj, property, Text.generateId().charAt(0));
					}
					else if (clz.isAssignableFrom(float.class)  || clz.isAssignableFrom(Float.class))
					{
						JavaBean.setProperty(obj, property, digits.generateFloat());
					}
					else if (clz.isAssignableFrom(byte.class)  || clz.isAssignableFrom(Byte.class))
					{
						JavaBean.setProperty(obj, property,Byte.valueOf(Text.generateId().getBytes(IO.CHARSET)[0]));
					}
					else if (clz.isAssignableFrom(boolean.class)  || clz.isAssignableFrom(Boolean.class))
					{
						if(Calendar.getInstance().getTime().getTime()%2 ==0)
							JavaBean.setProperty(obj, property, true);
						else
							JavaBean.setProperty(obj, property, false);
					}
					else if (clz.equals(BigDecimal.class))
					{
						JavaBean.setProperty(obj, property,digits.generateBigDecimal());
					}
					else if (clz.equals(java.sql.Time.class))
					{
						JavaBean.setProperty(obj, property, 
						new java.sql.Time(
						Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.sql.Date.class))
					{
						JavaBean.setProperty(obj, property, new java.sql.Date(Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.util.Date.class))
					{
						JavaBean.setProperty(obj, property, Calendar.getInstance().getTime());
					}
					//Timestamp
					else if (clz.equals(java.sql.Timestamp.class))
					{
						JavaBean.setProperty(obj, property, new java.sql.Timestamp(Calendar.getInstance().getTime().getTime()));
					}
					else if (clz.equals(java.util.Calendar.class))
					{
						JavaBean.setProperty(obj, property, Calendar.getInstance());
					}
					else if (clz.equals(LocalTime.class))
					{
						JavaBean.setProperty(obj, property, LocalTime.now());
					}
					else if (clz.equals(LocalDate.class))
					{
						JavaBean.setProperty(obj, property, LocalDate.now());
					}
					else if (clz.equals(LocalDateTime.class))
					{
						JavaBean.setProperty(obj, property, LocalDateTime.now());
					}
					else
					{
						JavaBean.setProperty(obj, property, ClassPath.newInstance(clz));
					}
				}
				catch (Exception e)
				{
					throw new SetupException("Cannot create property:"+property+" for object class:"
									+this.creationClass.getName()+"  ERROR:"+e.getMessage(),e); 
				}
			}
			
			return obj;
		}
		catch (RuntimeException e)
		{
			throw e;
			
		}
		catch (Exception e)
		{
			throw new RuntimeException(e.getMessage(),e);
		}
	}
355759
public static function instance($args = null)
    {
        $class = self::className();
        $instanceKey = self::instanceKey($args);

        if ( ! isset(self::$_instances[$instanceKey]))
        {
            self::$_instances[$instanceKey] = is_array($args) ? new $class($args) : new $class;
        }
        return self::$_instances[$instanceKey];
    }
272997
public static <S> PAreaFGenerator<S> create()
  {
    final Generator<Double> base = PrimitiveGenerators.doubles(0.0, 10000.0);
    return new PAreaFGenerator<>(() -> Float.valueOf(base.next().floatValue()));
  }