Here you can find the source of format(double number)
public static double format(double number)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; public class Main { private static final DecimalFormat formatter = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US)); public static double format(double number) { synchronized (formatter) { return new Double(formatter.format(number)); }//from ww w. jav a 2s .c om } }