BigInteger: add(BigInteger val) : BigInteger « java.math « Java by API
- Java by API
- java.math
- BigInteger
BigInteger: add(BigInteger val)
import java.math.BigInteger;
public class Main {
public static void main(String args[]) {
BigInteger n = new BigInteger("1000000000000");
BigInteger one = new BigInteger("1");
while (!n.isProbablePrime(7))
n = n.add(one);
System.out.println(n.toString(10) + " is probably prime.");
System.out.println("It is " + n.bitLength() + " bits in length.");
}
}
Related examples in the same category