Here you can find the source of formatCurrency(Float f)
public static String formatCurrency(Float f)
//package com.java2s; //License from project: Apache License import java.text.NumberFormat; import java.util.Locale; public class Main { public static final int FORMAT_CURRENCY = 1; public static final int FORMAT_INTEGER = 2; public static final int FORMAT_PERCENT = 3; public static String formatCurrency(Float f) { return formatFloat(f, FORMAT_CURRENCY); }/*from ww w . ja v a 2s . c o m*/ public static String formatFloat(Float f, int style) { String num = new String("0"); if (f != null) num = new String(f.toString()); else return ""; NumberFormat nf = null; switch (style) { case FORMAT_INTEGER: { nf = NumberFormat.getIntegerInstance(Locale.US); num = nf.format(Double.parseDouble(f.toString())); break; } case FORMAT_PERCENT: { nf = NumberFormat.getPercentInstance(Locale.US); num = nf.format(Double.parseDouble(f.toString())); break; } default: { nf = NumberFormat.getCurrencyInstance(Locale.US); num = nf.format(Double.parseDouble(f.toString())); } } return num; } }