Here you can find the source of format(double d)
public static String format(double d)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static DecimalFormat formatter = new DecimalFormat("#.###"); public static String format(double d) { return formatter.format(d); }//ww w . ja va2s . c o m }