Java tutorial
import java.math.BigInteger; import java.util.Random; public class Main { public static void main(String[] args) throws Exception { int bitLength = 512; // 512 bits Random rnd = new Random(); System.out.println("BitLength : " + bitLength); BigInteger mod = new BigInteger(bitLength, rnd); } }