Here you can find the source of formatDouble(double in)
static Double formatDouble(double in)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; public class Main { private static DecimalFormat doubleFormat = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.ENGLISH)); static Double formatDouble(double in) { return Double.parseDouble(formatDoubleToString(in)); }/*from ww w. ja v a 2 s. co m*/ static String formatDoubleToString(double in) { return doubleFormat.format(in); } }