Parsing big number to remove comma without losing precision in java
<p>I have a decimal number 999,999,999,999,999.999 as string from which, i need to remove the commas. For that I am using the following code - </p>

<pre><code>new BigDecimal(NumberFormat.getInstance().parse("999,999,999,999,999.999")
                      .doubleValue()).setScale(3,BigDecimal.ROUND_HALF_UP);
</code></pre>

<p>But this is giving me the rounded value 1000000000000000.000. But what I want is 999999999999999.999. Could anyone please let me how too get this done in java without losing precision. It is not possible what could be the alternate way to do this. </p>

<p>Using replaceAll() on String to replace "," with "" got on my mind but i would like to do it with numbers if it possible.</p>

<p>Thanks in advance.</p>
