I wrote the following method:
public static double round(double value, int scale) {
BigDecimal bd = new BigDecimal(value);
bd.setScale(scale, BigDecimal.ROUND_HALF_UP);
return bd.doubleValue();
}
I make the call:
round(72.46976811594203, 2)
And I get the following output:
72.46976811594203
I would like it to be returned 72.47, since I am rounding it to two decimal places. Where is the error?