I\'m having some problems formatting the decimals of a double. If I have a double value, e.g. 4.0, how do I format the decimals so that it\'s 4.00 instead?
You can do it as follows:
double d = 4.0; DecimalFormat df = new DecimalFormat("#.##"); System.out.print(df.format(d));