Here you can find the source of decimalFormat(Object obj)
public static String decimalFormat(Object obj)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String decimalFormat(Object obj) { if (null == obj) return ""; DecimalFormat df = new DecimalFormat("0.00"); return df.format(obj); }/* ww w . j a v a 2s . co m*/ public static String decimalFormat(Object obj, String format) { if (null == obj) return ""; DecimalFormat df = new DecimalFormat(format); return df.format(obj); } }