Here you can find the source of doubleToString4(double value)
public static String doubleToString4(double value)
//package com.java2s; //License from project: Open Source License public class Main { public static String doubleToString4(double value) { if (Double.isNaN(value)) { return " --- "; }//from www . j ava 2s. com return String.format("%.4f", value); } }