java does format round code example
Example 1: decimal up to 6 places in java
double num = 1.34567;
System.out.format("%.4f", num);
Example 2: java double format
NumberFormat formatter = new DecimalFormat("#0.00");
System.out.println(formatter.format(4.0));