Java Currency Format formatCurrency(BigDecimal bd)

Here you can find the source of formatCurrency(BigDecimal bd)

Description

format Currency

License

Apache License

Declaration

public static String formatCurrency(BigDecimal bd) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;
import java.text.NumberFormat;

import java.util.Locale;

public class Main {
    public static String formatCurrency(BigDecimal bd) {
        //Locale locale = new Locale("en_US");
        return formatCurrency(bd, Locale.US);
    }//from w  ww .  ja  v  a2s .  com

    public static String formatCurrency(BigDecimal bd, Locale locale) {
        if (bd == null)
            return (null);

        double d = bd.doubleValue();
        NumberFormat form = NumberFormat.getCurrencyInstance(locale);
        return (form.format(d));
    }
}

Related

  1. formatAsCurrency(BigDecimal nAmount)
  2. formatAsCurrency(final double value)
  3. formatAsCurrency(Number amount)
  4. formatAsCurrency(Number value)
  5. formatCurrency(BigDecimal amount)
  6. formatCurrency(double amount)
  7. formatCurrency(double amount, int precision, Locale locale)
  8. formatCurrency(double amt)
  9. formatCurrency(double num)