Java Money Format formatMoney(BigDecimal value)

Here you can find the source of formatMoney(BigDecimal value)

Description

Mascara texto com formatacao monetaria

License

Open Source License

Parameter

Parameter Description
value Valor a ser formatado

Return

Valor formatado de acordo com o padrao especificado

Declaration

public static String formatMoney(BigDecimal value) 

Method Source Code


//package com.java2s;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Locale;

public class Main {
    /**//  w  ww  . j ava2  s .  c  o m
     * Mascara texto com formatacao monetaria 
     * 
     * @param value Valor a ser formatado 
     * @return Valor formatado de acordo com o padrao especificado
     */
    public static String formatMoney(BigDecimal value) {
        NumberFormat money = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
        if (value != null) {
            return money.format(value);
        }
        return money.format(0);
    }
}

Related

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