print decimal java code example
Example 1: print up to 2 decimal in java
System.out.printf("%.2f", value);
Example 2: how to format a double in java to 2 decimal places
DecimalFormat df = new DecimalFormat("#.00");
System.out.printf("%.2f", value);
DecimalFormat df = new DecimalFormat("#.00");