Here you can find the source of formatNumber(Double number, String pattern)
public static String formatNumber(Double number, String pattern)
//package com.java2s; import java.text.DecimalFormat; public class Main { public static String formatNumber(Double number, String pattern) { DecimalFormat df = new DecimalFormat(pattern); return df.format(number); }//from www.j a va 2 s . com public static String formatNumber(Float number, String pattern) { DecimalFormat df = new DecimalFormat(pattern); return df.format(number); } public static String formatNumber(Integer number, String pattern) { DecimalFormat df = new DecimalFormat(pattern); return df.format(number); } }