Java BigDecimal Round Down issue
<p>I have some simple code to round up and round down, but it is producing some unexpected results.</p>

<pre><code>    public static void main(String[] args) throws Exception {
    // TODO Auto-generated method stub

    double a = 46.66;
    System.out.println("Roundup: " + roundUp(a,2) + "\nRound Down: " + roundDown(a,2));

}

public static double roundUp(double a, int scale)
{
    BigDecimal value = new BigDecimal(a);
    value = value.setScale(scale, RoundingMode.UP);
    return value.doubleValue();
}

public static double roundDown(double a, int scale)
{
    BigDecimal value = new BigDecimal(a);
    value = value.setScale(scale, RoundingMode.DOWN);
    return value.doubleValue();
}
</code></pre>

<p>When I use 3 digits after decimal, it is working as expected. If a = 44.661, the output is as expected as below.</p>

<p>Roundup: 46.67  Round Down: 46.66</p>

<p>When a=44.66, the round down value reduces by 1 which is unexpected as below. </p>

<p>Roundup: 46.66  Round Down: 46.65</p>

<p>How do I get 44.66 for round down and 44.67 for roundUp while still retaining the above results.</p>

<p>Thanks in advance for your help</p>
