double amount =200.0;
Locale locale = new Locale("en", "US");
NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(locale);
System.out.println(currencyFormatter.format(amount));
or
double amount =200.0;
System.out.println(NumberFormat.getCurrencyInstance(new Locale("en", "US"))
.format(amount));
The best way to display currency
Output
$200.00
If you don't want to use sign use this method
double amount = 200;
DecimalFormat twoPlaces = new DecimalFormat("0.00");
System.out.println(twoPlaces.format(amount));
200.00
This also can be use (With the thousand separator )
double amount = 2000000;
System.out.println(String.format("%,.2f", amount));
2,000,000.00