Here you can find the source of formatCurrency(double amount)
public static String formatCurrency(double amount)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.text.DecimalFormat; import java.text.NumberFormat; public class Main { private static final NumberFormat cashAmount = new DecimalFormat("$#,##0.00"); public static String formatCurrency(double amount) { return cashAmount.format(amount); }/*from w w w . ja v a 2 s .co m*/ }