Using BigDecimal
, how can I convert 2.00
to 2
, 1.1230
to 1.123
etc?
How can I get 0
from 2.00
, 1 from 1.10000
or 3 from 0.123
? (lowest scale that don't change the value)
For the first part, BigDecimal.stripTrailingZeros()
I'm not at all sure what you mean about the second part, though. Do you want the last digit, or something?