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?
double d = 4.0; DecimalFormat nf = DecimalFormat.getInstance(Locale.ENGLISH); System.out.println(nf.format("#.##"));