Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Database, One Column has value as "0.000000000000". How to print the "0.000000000000" as a whole?

In the Database, 1 column has a value stored as "0.000000000000". I need to compare it with UI field which has exactly same value.

I tried to get the value with Big Decimal and tried to convert it into String but it always coverts it into '0E-12' or '0.0'. How Can I compare it with UI (which is in String format)?

like image 506
Jazz Avatar asked Dec 09 '25 17:12

Jazz


1 Answers

Have you tried

BigDecimal bd = new BigDecimal("0.000000000000");
System.out.println(bd.toPlainString().equals("0.000000000000"));

output

true
like image 173
Scary Wombat Avatar answered Dec 11 '25 06:12

Scary Wombat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!