如何在int中添加空白空间? [英] How to add empty space inside int?
本文介绍了如何在int中添加空白空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
100 000 000
。你可以马上知道这个数字是1亿。解决方案
您也可以尝试DecimalFormat;
DecimalFormat formatter = new DecimalFormat(#,###);
System.out.println(formatter.format(100000));
结果:
1000>> 1,000
pre>
10000>> 10,000
100000>> 100,000
1000000>> 1,000,000
Let's say I want to print the number 100000000. At first sight it is difficult to tell how many millions this number is representing. Is it 10 million or 100 million? How can I make big numbers in Java look more readable? Something like this for instance would be great:
100 000 000
. You can tell right away that the number is 100 million.解决方案You can also try DecimalFormat;
DecimalFormat formatter = new DecimalFormat("#,###"); System.out.println(formatter.format(100000));
Results:
1000>>1,000 10000>>10,000 100000>>100,000 1000000>>1,000,000
这篇关于如何在int中添加空白空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文