Zero Cool Zero Cool - 1 year ago 107
Java Question

Java BigDecimal remove decimal and trailing numbers

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.

I've tried:


but BigDecimal is not supported.

Any ideas?

Thanks very much.

Answer Source

Try number.toBigInteger().toString()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download