I have to retain the exact value of a Double and convert it into a string.
Double value = 105312453566.35363465;
I tried doing a toString() on the above Double value... but it returns me an output 1.0531245356635364E11
Hence I tried converting it into a BigDecimal format using the below code... so that I can retain the exact value..
BigDecimal newValue = new BigDecimal(value);
System.out.println("BigDecimal Value: " + newValue);
But the output which I get is like this :
BigDecimal Value: 105312453566.3536376953125
which is again not what I want.
How can I get the exact value?
Double value = 105312453566.35363465;
I tried doing a toString() on the above Double value... but it returns me an output 1.0531245356635364E11
Hence I tried converting it into a BigDecimal format using the below code... so that I can retain the exact value..
BigDecimal newValue = new BigDecimal(value);
System.out.println("BigDecimal Value: " + newValue);
But the output which I get is like this :
BigDecimal Value: 105312453566.3536376953125
which is again not what I want.
How can I get the exact value?