有没有办法获得 'BigInteger' 变量的总大小?

Is there a way to get the total size of a 'BigInteger' variable?

我想知道在我的程序中 BigInteger 类型的变量有多大。

这可能吗?

使用bitLength() (source)

The java.math.BigInteger.bitLength() returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation.

BigInteger bi;
bi = new BigInteger("778674");
System.out.println("length: " + bi.bitLength());