Here you can find the source of double2String(double d)
public static String double2String(double d)
//package com.java2s; //License from project: Open Source License import java.text.NumberFormat; import java.util.Locale; public class Main { public static String double2String(double d) { return (double2String(d, 5)); }//ww w .j av a2 s .c o m public static String double2String(double d, int prec) { NumberFormat numberFormatter = NumberFormat .getNumberInstance(Locale.GERMAN); numberFormatter.setMaximumFractionDigits(prec); String res = numberFormatter.format(d); return (res); } }