Java tutorial
//package com.java2s; import java.text.DecimalFormat; public class Main { public static double format2(double input) { DecimalFormat df = new DecimalFormat("#.00"); return Double.valueOf(df.format(input)); } }