Here you can find the source of formatDouble(double d)
public static String formatDouble(double d)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatDouble(double d) { String s = "" + d; if (s.endsWith(".0")) s = s.substring(0, s.length() - 2); return s; }/*from w w w .j a va 2s . com*/ }