Java Utililty Methods Currency Format

List of utility methods to do Currency Format

Description

The list of methods to do Currency Format are organized into topic(s).

Method

StringformatCurrency(BigDecimal bd)
format Currency
return formatCurrency(bd, Locale.US);
StringformatCurrency(double amount)
format Currency
return cashAmount.format(amount);
StringformatCurrency(double amount, int precision, Locale locale)
format Currency
NumberFormat nf = NumberFormat.getCurrencyInstance(locale);
nf.setMinimumFractionDigits(precision);
nf.setMaximumFractionDigits(precision);
return nf.format(amount);
StringformatCurrency(double amt)
Will format the currency according to the current users locale.
return formatCurrency(amt, 2);
StringformatCurrency(double num)
Formats a number to the currency used on the server.
return NumberFormat.getCurrencyInstance(Locale.US).format(num);
StringformatCurrency(Double number)
Formats double as a string with 2 decimal places
DecimalFormat formatter = new DecimalFormat("0.00");
return formatter.format(number);
StringformatCurrency(Double value)
format Currency
String result = "0.00";
if (value != null)
    result = new DecimalFormat(",##0.00").format(value);
return result;
StringformatCurrency(final Double currencyValue, final Locale locale, final boolean isGroup)
format Currency
String formattedText = null;
if (null != currencyValue && null != locale) {
    final NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
    numberFormat.setGroupingUsed(isGroup);
    formattedText = numberFormat.format(currencyValue);
return formattedText;
StringformatCurrency(Float amt)
format Currency
NumberFormat formatter = NumberFormat.getCurrencyInstance();
return formatter.format(amt);
StringformatCurrency(Float f)
format Currency
return formatFloat(f, FORMAT_CURRENCY);