I see that BigDecimal has an inflate() method on equals() method. What does inflate() do actually?
Basically, inflate()
calls BigInteger.valueOf(intCompact)
if necessary, i.e. it creates the unscaled value that is stored as a BigInteger
from long intCompact
. If you don't need that BigInteger
and the unscaled value fits into a long
BigDecimal
seems to try to save space as long as possible.