Home > OS >  Get value of BigDecimal created from string [closed]
Get value of BigDecimal created from string [closed]

Time:10-07

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?

CodePudding user response:

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.

  •  Tags:  
  • java
  • Related