Java BigInteger nextProbablePrime() MethodThe nextProbablePrime() method of Java BigInteger class is used to find the next Prime Number greater than the current BigInteger. This method returns the first integer greater than this BigInteger that is probably prime. Syntax:Parameter:NA Returns:This method returns the first integer greater than this BigInteger that is probably prime. Exception:ArithmeticException < this < 0 or this is too large. Note:Example 1Test it NowOutput: Next Probable Prime after 10 is 11 Next Probable Prime after 23 is 29 Example 2Test it NowOutput: java.lang.ArithmeticException: start < 0: -23 Next TopicJava BigInteger |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India