Here you can find the source of decimalString(double d, boolean forceDigits)
public static String decimalString(double d, boolean forceDigits)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; public class Main { private static DecimalFormat df = new DecimalFormat("0.##"); private static DecimalFormat dfForce = new DecimalFormat("00.00"); public static String decimalString(double d, boolean forceDigits) { return forceDigits ? dfForce.format(d) : df.format(d); }/*from ww w.j av a 2 s .c om*/ }