Feb
25
|
You can use the setScale() method to control the rounding of a decimal value as shown in the following example:
double value = 123.456789; BigDecimal bd = new BigDecimal(value).setScale(2, BigDecimal.ROUND_HALF_UP); System.out.println(bd);
Leave a Reply
You must be logged in to post a comment.