java double format

Java
NumberFormat formatter = new DecimalFormat("#0.00");     
System.out.println(formatter.format(4.0));
Source

Also in Java: