Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; import java.util.Random; public class BigIntegerProbablePrimeExample1 { public static void main(String[] args) { // create a BigInteger object BigInteger big1; // create and assign value to bitLength int bitLength = 4; // create a random object Random rnd = new Random(); // assign probablePrime result to big1 using bitLength and rnd // static method is called using class name big1 = BigInteger.probablePrime(bitLength,rnd); String str = "ProbablePrime of bitlength "+bitLength+" is "+big1; // print big1 value System.out.println(str); } }
Output