为什么在Java中BigInteger.bitLength()打印:0-1
System.out.println(BigInteger.valueOf(-1).bitLength());
BigInteger 的源代码中有一条注释说:
bitLength 尚未初始化
public int bitLength() {
int n = bitLengthPlusOne - 1;
if (n == -1) { // bitLength not initialized yet
int[] m = mag;
int len = m.length;
if (len == 0) {
n = 0; // offset by one to initialize
}
茅侃侃
临摹微笑
相关分类