Here you can find the source of format(Object num, int dev, String valueIfZero)
public static String format(Object num, int dev, String valueIfZero)
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { public static String format(Object num, int dev, String valueIfZero) { if (num == null) { return valueIfZero; }/*from w w w . j a v a 2 s .c om*/ if (dev == 0) { dev = 1; } double f = Double.parseDouble(num.toString()); f = f / dev; if (f < 0.01) { return valueIfZero; } DecimalFormat df1 = new DecimalFormat("##########0.00"); return df1.format(f); } }