Hello programming community,
I have the following code to round my answers to 2 decimal places:
double roundedValue;
DecimalFormat twoDForm = new DecimalFormat ("#.##");
roundedValue = Double.valueOf(twoDForm.format(value));
The code works great and what i expect it to do. When I pass in really big decimal numbers (2.55555668) it correctly rounds it (2.56) but when it rounds the number and the last decimal is a zero it does not display this. (if the number ends up rounding to 4.50 , i want it to display it this way but it ends up getting rid of the 0. )
If anyone has any ideas for a way to fix this please let me know.
Thanks.