java how to format d to 2 decimal places code example Example: how to format a double in java to 2 decimal places DecimalFormat df = new DecimalFormat("#.00");