(1) Generate a random BigInteger in range of [0, 2^(numBits)-1]
BigInteger(int numBits, Random rnd)
(1) Generate a random BigInteger in range of [0, 2^(numBits)-1]
BigInteger(int numBits, Random rnd)
Use -Xmx to set the maximum heap size (which may use hard drive space as Java heap). e.g. set the max heap size to 10GB:
java -Xmx10g MainClass
It may be further optimized using garbage collectors such ConcurrentMarkSweep:
java -Xmx10g -XX:+UseConcMarkSweepGC MainClass
echo $(/usr/libexec/java_home)