/**
* A class used to represent multiprecision integers that makes efficient
* use of allocated space by allowing a number to occupy only part of
* an array so that the arrays do not have to be reallocated as often.
* When performing an operation with many iterations the array used to
* hold a number is only reallocated when necessary and does not have to
* be the same size as the number it represents. A mutable number allows
* calculations to occur on the same number without having to create
* a new number for every step of the calculation as occurs with
* BigIntegers.
*
* @see BigInteger
* @version 1.12, 12/19/03
* @author Michael McCloskey
* @since 1.3
*/
我猜MutableBigInteger在内部用于BigInteger繁重的计算,这些计算会因频繁的重新分配而变慢.我不确定为什么它不作为java.math的一部分导出.也许对可变价值类有些厌恶?
澄清“可变”:
标准BigInteger在其整个生命周期中都有一个值,给定两个BigInteger引用“a”& “b”,“a b”将始终产生具有相同值的新BigInteger.假设价值是4.
使用MutableBigInteger,“ab”最初可以产生4,但由于其他代码改变了由“a”和amp引用的对象的值(也就是变异),在未来的某个时间点会产生8,16,32或任何其他数字. ; “B”.因此,Java中的大多数(可能是所有)值类型(Character,Short,Long,Integer,BigInteger,BigDecimal,Float,Double,甚至String)都是不可变的.