What is the purpose of java.math.MutableBigInteger?

前端 未结 3 1852
滥情空心
滥情空心 2020-12-17 18:55

java.math.MutableBigInteger is only available from inside the package. It inherits from java.lang.Object and there is only one subclass (Sign

3条回答
  •  甜味超标
    2020-12-17 19:04

    MutableBigInteger is referenced in the java.math library. If you have a JDK installed check out the contents of src.zip in your jdk directory.

    You will see BigInteger uses it:

    public BigInteger divide(BigInteger val) {
        MutableBigInteger q = new MutableBigInteger(),
                          r = new MutableBigInteger(),
                          a = new MutableBigInteger(this.mag),
                          b = new MutableBigInteger(val.mag);
    
        a.divide(b, q, r);
        return new BigInteger(q, this.signum * val.signum);
    }
    

    MutableBigInteger is an encapsulation of the mathematical algorithms used by BigInteger.

提交回复
热议问题