如何在Java中将字符串0E-11转换为0.00000000000? 我想以非科学记数法显示数字。 我已经尝试过查看Java中的数字格式化程序,但是我需要具体说明我想要的确切小数位数,但我不会总是知道。 我只想要原始数字所指定的小数位数。
How to convert a string 0E-11 to 0.00000000000 in Java? I want to display the number in non scientific notations. I've tried looking at the number formatter in Java, however I need to specific the exact number of decimals I want but I will not always know. I simply want the number of decimal places as specificed by my original number.
最满意答案
我会使用BigDecimal.Pass将您的字符串作为参数添加到其中,然后使用String.format来表示新创建的BigDecimal而不使用科学记数法。 也可以使用Float或Double类。
I would use BigDecimal.Pass your string into it as a parameter and then use String.format to represent your newly created BigDecimal without scientific notation. Float or Double classes can be used too.
更多推荐
发布评论