BigInteger(int bitLength, int certainty, Random rnd) constructor from BigInteger has the following syntax.
public BigInteger(int bitLength, int certainty, Random rnd)
In the following code shows how to use BigInteger.BigInteger(int bitLength, int certainty, Random rnd) constructor.
import java.math.BigInteger; import java.security.SecureRandom; /*from w w w .ja v a 2 s . com*/ public class Main { public static void main(String[] args) throws Exception { int bitLength = 512; // 512 bits SecureRandom rnd = new SecureRandom(); int certainty = 90; // 1 - 1/2(90) certainty BigInteger mod = new BigInteger(bitLength, certainty, rnd); System.out.println(mod); } }
The code above generates the following result.