Java BigInteger类| nextProbablePrime()方法与示例
BigInteger类nextProbablePrime()方法 (BigInteger Class nextProbablePrime() method)
nextProbablePrime() method is available in java.math package.
nextProbablePrime()方法在java.math包中可用。
nextProbablePrime() method is used to get the next probable prime number that should be higher than this BigInteger and there is a limit of composite number that should not exceed 2 pow(-100).
nextProbablePrime()方法用于获取下一个可能大于此BigInteger的下一个素数,并且合成数的限制不得超过2 pow(-100)。
nextProbablePrime() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.
nextProbablePrime()方法是一种非静态方法,仅可通过类对象访问,如果尝试使用类名访问该方法,则会收到错误消息。
nextProbablePrime() method may throw an exception at the time of returning the next probable prime number.
nextProbablePrime()方法在返回下一个可能的质数时可能会引发异常。
ArithmeticException: This exception may throw when the value of this BigInteger is negative.
ArithmeticException :如果此BigInteger的值为负,则可能引发此异常。
Syntax:
句法:
public BigInteger nextProbablePrime();
Parameter(s):
参数:
None
没有
Return value:
返回值:
The return type of this method is BigInteger, it returns BigInteger that holds the value larger than this BigInteger and it is probably prime.
此方法的返回类型为BigInteger ,它返回的BigInteger持有的值大于此BigInteger,并且它可能是素数。
Example:
例:
// Java program to demonstrate the example
// of BigInteger nextProbablePrime() method of BigInteger
import java.math.*;
public class NextProbablePrimeOfBI {public static void main(String args[]) {// Initialize two variables str1 and str2
String str1 = "13";
String str2 = "6";
// Initialize two BigInteger objects
BigInteger b_int1 = new BigInteger(str1);
BigInteger b_int2 = new BigInteger(str2);
// returns the next prime number
// of this BigInteger b_int1 so the value of
// this BigInteger is 13 then the next prime
// after 13 is 17
BigInteger next_prime = b_int1.nextProbablePrime();
System.out.println("b_int1: " + b_int1);
System.out.println("b_int1.nextProbablePrime(): " + next_prime);
System.out.println();
// returns the next prime number
// of this BigInteger b_int2 so the value of
// this BigInteger is 6 then the next prime
// after 6 is 7
next_prime = b_int2.nextProbablePrime();
System.out.println("b_int2: " + b_int2);
System.out.println("b_int2.nextProbablePrime(): " + next_prime);
}
}
Output
输出量
b_int1: 13
b_int1.nextProbablePrime(): 17b_int2: 6
b_int2.nextProbablePrime(): 7
翻译自: https://www.includehelp.com/java/biginteger-nextprobableprime-method-with-example.aspx
Java BigInteger类| nextProbablePrime()方法与示例相关推荐
- java annotation class,Java Class类 isAnnotation()方法及示例
Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...
- java字符类型的返回值,Java字符类isWhitespace()方法及示例
Character 类isWhitespace()法isWhitespace()方法在java.lang包中可用. isWhitespace()方法用于检查给定的char值是否为空格,但是它包含空格中 ...
- Java BigInteger类| 带示例的shiftLeft()方法
BigInteger类shiftLeft()方法 (BigInteger Class shiftLeft() method) shiftLeft() method is available in ja ...
- Java BigInteger类| modInverse()方法与示例
BigInteger类modInverse()方法 (BigInteger Class modInverse() method) modInverse() method is available in ...
- Java BigInteger类| and()方法与示例
BigInteger类和()方法 (BigInteger Class and() method) and() method is available in java.math package. and ...
- Java BigInteger类| 带有示例的减去()方法
BigInteger类减去()方法 (BigInteger Class subtract() method) subtract() method is available in java.math p ...
- Java BigInteger类| toByteArray()方法与示例
BigInteger类testBit()方法 (BigInteger Class testBit() method) testBit() method is available in java.mat ...
- Java BigInteger类| hashCode()方法与示例
BigInteger类hashCode()方法 (BigInteger Class hashCode() method) hashCode() method is available in java. ...
- Java BigInteger类| isProbablePrime()方法与示例
BigInteger类isProbablePrime()方法 (BigInteger Class isProbablePrime() method) isProbablePrime() method ...
最新文章
- 一行命令搞定图像质量评价 | 附代码和操作步骤
- C#和F#默认接口方法更新
- docker-compose:使用docker-compose部署nginx+supervisor+uwsgi+flask程序(mongodb)
- Android L Settings 简要分析
- 超越提升和迁移 充分利用云计算的七种方法
- java scavenge_请概述一下Java中都有哪些垃圾收集器
- ecshop使用php代码,ecshop 修改模板可输出php代码
- 浏览器 UC 自动添加关键字 去掉关键字
- 一步一步写算法(之排序二叉树删除-2)
- jedis的源码理解-基础篇
- 写论文的一点经验小记
- 十字链表表示矩阵c语言,十字链表法,十字链表压缩存储稀疏矩阵详解
- wpa_supplicant状态机
- (转)原子时代来临-Intel革命性Atom透析
- 【搬家】VB.NET开发全功能串口调试助手
- 小程序开发语言python_微信小程序是用什么语言开发的呢
- 计算机中软件重启后没有,为什么电脑一开机软件就都没有了
- Windows DNS服务器的子网掩码排序
- 梯度下降【无约束最优化问题】
- 闭关28天,奉上[Java一线大厂高岗面试题解析合集],备战金九银十
热门文章
- matlab imread_MATLAB图像处理:29:在几何变换输出中指定填充值
- win7安装硬盘后无法启动计算机,硬盘装Win7系统电脑后开机提示DISK BOOT FAILURE怎么办【图文】...
- java的乐趣_分享java带来的快乐
- 数据卡片_E015 如何批量汇总工作簿数据,形成独立工作簿信息卡片
- linux ibus获取窗体位置,Ubuntu 12.04 显示ibus 的输入框
- mysql临时表 清空_在数据库中临时表什么时候会被清除呢
- Docker挂了,数据如何找回
- wordpress后台无法登录问题
- laravel安装laravel-ide-helper扩展进行代码提示(二)
- 极光推送小结 - iOS