//保留两位小数并展示千分位符
DecimalFormat df1 = new DecimalFormat("##,##0.00");
System.out.println(df1.format(0.2));// 0.20
System.out.println(df1.format(0.235));// 0.24
System.out.println(df1.format(0.2351));// 0.24
System.out.println(df1.format(42));// 42.00
System.out.println(df1.format(0.29));// 0.29
System.out.println(df1.format(999999999));//999,999,999.00
System.out.println(df1.format(0));//0.00
b=new BigDecimal("9999999999");//10位 十亿
System.out.println(df1.format(b));//9,999,999,999.00
b=new BigDecimal("9999999999999");//13位
System.out.println(df1.format(b));//9,999,999,999,999.00
还没有评论,来说两句吧...