Here you can find the source of formatDoubleToString(double d)
public static String formatDoubleToString(double d)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatDoubleToString(double d) { if (d == (long) d) return String.format("%d", (long) d); else// ww w .j av a 2 s . com return String.format("%s", d); } }