有人可以向我解释当使用public BigInteger(byte[] val)
时,两个边缘但非平凡的不同字节数组可以产生相同的BigInteger吗?不同的字节[] =>相同的BigInteger?
哪有......
import java.math.BigInteger;
public class BigIntegerTest
{
public static void main(String[] args)
{
BigInteger a = new BigInteger(new byte[] {-1, -1, -1, -1, 123});
BigInteger b = new BigInteger(new byte[] {-1, 123});
System.out.println(a.toString(16)+" .equals "+b.toString(16)+" ? "+(a.equals(b)));
}
}
...打印真的吗?
我确定我误解了JavaDocs,但是我不知道它在哪里。我会检查来源......但是,呃,我找不到它。
我错过了什么?
酱汁:http://www.docjar.org/html/api/java/math/BigInteger.java.html#171 –
谢谢!在2862行找到我需要的东西。这些资源的官方程度如何?我似乎记得能够从Sun下载源代码,但Oracle只会将我指向OpenJDK。 – DowntroddenCodeMonkey
这两个是相同的原因,150是相同的0150. –