BigInteger构造函数解析

1、BigInteger(byte[] val)
这个构造函数用于转换一个字节数组包含BigInteger的二进制补码,以二进制表示成一个BigInteger。

(用字节数组中值的ASCII码构造BigInteger)

2、BigInteger(int signum, byte[] magnitude)
此构造函数用于将BigInteger的符号大小表示法转换成一个BigInteger值。

(和第一种一样,增加了符号:1,0,-1)

3、BigInteger(int bitLength, int certainty, Random rnd)
此构造函数用于构造一个随机生成正BigInteger的可能是以指定的bitLength的素数。

(bitLength:返回的 BigInteger 的 bitLength;

certainty:调用方允许的不确定性的度量。新的 BigInteger 表示素数的概率超出 (1 - 1/2certainty)。此构造方法的执行时间与此参数的值是成比例的;

rnd:随机比特源,用这些随机比特选择用来进行质数测试的候选数。)

4、BigInteger(int numBits, Random rnd)
此构造函数用于构造一个随机生成的BigInteger,范围在0到 (2numBits - 1), 包括边界值。

5、BigInteger(String val)
此构造函数用于将十进制的字符串转换成一个BigInteger值表示形式。

6、BigInteger(String val, int radix)
这个构造函数用于将指定基数的数值字符串转换为BigInteger表示形式。

原文地址:https://www.cnblogs.com/exmyth/p/13594195.html