-1

This:

BigDecimal.valueOf(0.00)

becomes 0.0

I want it to be 0.00

What is the correct format pattern for that?

Steve Waters
  • 3,348
  • 9
  • 54
  • 94

2 Answers2

0

Use the String constructor: new BigDecimal("0.00"). Using BigDecimal.valueOf(double) completely destroys any formatting you used to input the value.

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413
0

Try this

value = value.setScale(2, RoundingMode.CEILING)
harshithdwivedi
  • 1,411
  • 16
  • 37