我一直在寻找相当长的一段时间,而且我几乎没有发现BigInteger它实际上如何保持它的数字.它们是一系列字符吗?别的什么?如何将数据转换为/从BigInteger?
从我发现的,我假设所有任意精度类,如BigInteger和BigDecimal,将数据保存为字符数组.它是如何实际工作的?还是只是人们的猜测?
我问,因为我一直在努力实现自己的实现BigInteger,但我无法弄清楚如何保持数字大于Long.MAX_VALUE(我不记得实际的数字).
提前致谢.
cor*_*iKa 25
与 int[]
从来源:
/**
* The magnitude of this BigInteger, in <i>big-endian</i> order: the
* zeroth element of this array is the most-significant int of the
* magnitude. The magnitude must be "minimal" in that the most-significant
* int ({@code mag[0]}) must be non-zero. This is necessary to
* ensure that there is exactly one representation for each BigInteger
* value. Note that this implies that the BigInteger zero has a
* zero-length mag array.
*/
final int[] mag;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12151 次 |
| 最近记录: |