Here you can find the source of getValidString(Double value, DecimalFormat formatter)
public static String getValidString(Double value, DecimalFormat formatter)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { public static String getValidString(Double value, DecimalFormat formatter) { String str = ""; if (value == null || Double.isNaN(value)) str = "NaN"; else//w w w . j a v a2 s.co m str = formatter.format(value) + ""; return str; } }