Java Money Format formatMoney(BigDecimal money, Locale locale)

Here you can find the source of formatMoney(BigDecimal money, Locale locale)

Description

format Money

License

Open Source License

Declaration

public static String formatMoney(BigDecimal money, Locale locale) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;

public class Main {
    public static String formatMoney(BigDecimal money, Locale locale) {
        if (money == null)
            return null;
        if (locale != null) {
            ResourceBundle bundle = ResourceBundle.getBundle(
                    "entityNotifications", locale);

            NumberFormat format = NumberFormat.getNumberInstance(locale);
            ((DecimalFormat) format).applyPattern(bundle
                    .getString("format.float.invoice"));

            return format.format(money.doubleValue());
        }/* w  w w.  ja v  a2s . co  m*/

        return new DecimalFormat("#0.00").format(money);
    }
}

Related

  1. format(Object money)
  2. format2Money(double value)
  3. formatBookkeeperMoney(double cents, Locale locale)
  4. formatDoubleToMoneyString(double num)
  5. formatMoney(BigDecimal bd)
  6. formatMoney(BigDecimal value)
  7. formatMoney(double cents, Locale locale)
  8. formatMoney(double dtSource)
  9. formatMoney(double money, int scalar)