Skip to content
Advertisement

Get value of BigDecimal created from string [closed]

I have created a BigDecimal with a scale of 2 like

BigDecimal decimal = new BigDecimal("5.99");

How can I extract the value of the bigdecimal to get 599?

Advertisement

Answer

This is straightforward: it’s just bigDecimal.unscaledValue() to get the significant digits of the BigDecimal without a decimal point or a raise to a power of ten.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement