How to format decimal places which contains different values
<pre><code>double d1 = "4.0"
double d2 = "4.2"
double d3 = "4.28"
</code></pre>

<p>I perform an arithmetic operation and it results in the above values with a maximum scale of 2. For <code>d1</code>, I would prefer that the value be formatted to a simple integer (e.g. <code>4</code> in this case) and the formatting on the rest of the values <code>d2, d3</code> . How should I do this?</p>
