Here you can find the source of formatDouble(double value)
public static final String formatDouble(double value)
//package com.java2s; //This Source Code Form is subject to the terms of the Mozilla Public License, public class Main { public static final String formatDouble(double value) { return truncate("" + value, 4); }/*from ww w . j a va2 s . c o m*/ public static final String truncate(String in, int length) { if (in.length() <= length) { return in; } return in.substring(0, length); } }