Here you can find the source of format(Number value)
public static String format(Number value)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; public class Main { public static final String DEFAULT_PATTERN = "'$'#,##0.00"; public static String format(Number value) { return format(value, DEFAULT_PATTERN); }//from ww w .j a v a 2 s . com public static String format(Number value, String pattern) { return value != null ? new DecimalFormat(pattern).format(new BigDecimal(BigInteger.valueOf(value.longValue()), 2)) : null; } }