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?
Using String.format, you can do this:
double price = 52000; String.format("$%,.2f", price);
Notice the comma which makes this different from @Vincent's answer
Output:
$52,000.00
A good resource for formatting is the official java page on the subject