Format double to 2 decimal places
<p>I am trying to Format my double value to exact 2 decimal places and it seems to working fine, here is the code i am trying</p>

<pre><code>final NumberFormat df = DecimalFormat.getInstance();
df.setMinimumFractionDigits(2);
df.setMaximumFractionDigits(2);
df.setRoundingMode(RoundingMode.DOWN);
df.format(value)
</code></pre>

<p>Till now everything is working, but i need to return double value as it is being used for other calculations and i tried </p>

<pre><code>Double.parseDouble(df.format(value))
</code></pre>

<p>with big decimal like</p>

<pre><code>BigDecimal price = new BigDecimal(df.format(number));
</code></pre>

<p>but it is not working as expected 
like <code>18.50</code> is being converted as <code>18.5</code></p>

<p>Though this is not an issue with calculations but i need to show amount on the UI where i have to show exactly up to 2 decimal places.</p>

<p>Is there any was i can handle it in java class or i have to take care in JSP with JSTL</p>
