Java BigDecimal删除小数和尾随数字 [英] Java BigDecimal remove decimal and trailing numbers
本文介绍了Java BigDecimal删除小数和尾随数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Java的新手并尝试使用BigDecimal(例如99999999.99)并将其转换为字符串但没有小数位和尾随数字。另外,我不需要数字中的逗号,也不需要舍入。
I'm new to Java and trying to take a BigDecimal (for example 99999999.99) and convert it to a string but without the decimal place and trailing numbers. Also, I don't want commas in the number and rounding is not needed.
我试过:
Math.Truncate(number)
但BigDecimal不是支持。
but BigDecimal is not supported.
任何想法?
非常感谢。
推荐答案
尝试 number.toBigInteger()。toString()
这篇关于Java BigDecimal删除小数和尾随数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文