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);
↧