So I have this code
public String getRounded(double amount) {
DecimalFormat df = new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.HALF_UP);
System.out.println(df.format(amount));
System.out.println(amount);
return df.format(amount);
}
I've added those two lines to see the difference and this is an example of what they display.
The output is this for example:
1.25
1.255
Why does this happen? Isn't the point of HALF_UP to round up? I've tried with CEILING and it does round up, although that's not what I want in this case.
Thank you