將可轉化為數字類型對象進行格式化

double i = 100000.656321;
NumberFormat form = new DecimalFormat("#,##0.00");
out.println(form.format(i));


顯示結果:100,000.66 (有自動四捨五入)

转载于:https://my.oschina.net/dddgggaaa/blog/204936

猜你喜欢

转载自blog.csdn.net/weixin_34005042/article/details/92046891
今日推荐