Here you can find the source of formatValue(Object value)
public static String formatValue(Object value)
//package com.java2s; //License from project: Open Source License public class Main { public static String formatValue(Object value) { if (value == null) { return "0"; }// w w w . j av a 2s.c om if (value instanceof Long) { return String.valueOf((Long) value); } else if (value instanceof Double) { return formatSimpleDouble((Double) value); } else { return String.valueOf(value); } } public static String formatSimpleDouble(Double value) { try { java.text.DecimalFormat form = new java.text.DecimalFormat( "##0.000"); String s = form.format(value); return s; } catch (Exception e) { return "0.000"; } } }