Online Java Compiler By
JavaTpoint.com
import java.math.BigInteger; public class BigIntegerNextProbablePrimeExample1{ public static void main(String[] args){ // create 4 BigInteger object BigInteger big1,big2,big3,big4; // assign value to big1,big2 big1= new BigInteger("10"); big2= new BigInteger("23"); // assign nextProbablevalue of big1,big2 to big3,big4 big3= big1.nextProbablePrime(); big4= big2.nextProbablePrime(); String str1 =" Next Probable prime after "+ big1+ " is "+ big3; String str2 =" Next Probable prime after "+ big2+ " is "+ big4; System.out.println(str1); System.out.println(str2); } }
Output