BigDecimal formatting without any rounding
Posted on 2006-06-16
We have a requirement where we need to work with java.math.BigDecimal and format it in such a way so that the display would always have four decimal digits, appropriate commas and NO rounding up or down. Meaning,
We tried to format the big decimal with DecimalFormat("#,##0.0000") but there is some rounding on the decimal value i.e., if input is 0.00006 then the output is 0.0001 whereas it shoud be just 0.0000.
Any help on this would be must useful. Thanks.