–
Formatting a Decimal Number
print a decimal numbe
1 | System.out.printf("Value with 3 digits after decimal point %.3f %n", PI); |
format the value with the DecimalFormat
1 | DecimalFormat df = new DecimalFormat("###.###"); |
Rounding Doubles with BigDecimal
1 | private static double round(double value, int places) { |