public static void main(String[] args) { BigDecimal b = new BigDecimal("10000000000000000.12312"); System.out.println(decimalFormat(b)); } private static String decimalFormat(BigDecimal amount) { if(amount == null) { return ""; } amount = amount.divide(BigDecimal.ONE,2, BigDecimal.ROUND_HALF_UP); String[] s = amount.toString().split("\."); StringBuffer buffer = new StringBuffer(); char[] cs = s[0].toCharArray(); for(int i = cs.length - 1;i >= 0;i --) { buffer.append(cs[cs.length-i-1]); if((i)%3==0 && cs.length > 3 && i != 0) { buffer.append(","); } } buffer.append(".").append(s[1]); return buffer.toString(); }