Java Utililty Methods Money Format

List of utility methods to do Money Format

Description

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

Method

StringbeautifyMoney(long money)
beautify Money
String res = "";
String tmp = String.valueOf(money);
Boolean isNegative = false;
if (tmp.indexOf("-") >= 0) {
    isNegative = true;
    tmp = tmp.replace("-", "");
int length = tmp.length();
...
Stringformat(Object money)
format
return format(money, CURRENCY_FORMAT);
Stringformat2Money(double value)
format Money
return format2.format(value);
StringformatBookkeeperMoney(double cents, Locale locale)
Like money-format (e.g.
NumberFormat formatter = NumberFormat.getCurrencyInstance(locale);
return formatter.format(cents / 100);
StringformatDoubleToMoneyString(double num)
format Double To Money String
java.text.DecimalFormat formate = new DecimalFormat("0.00");
return formate.format(num);
StringformatMoney(BigDecimal bd)
format Money
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
nf.setRoundingMode(RoundingMode.HALF_EVEN);
return nf.format(bd.setScale(2, RoundingMode.HALF_EVEN));
StringformatMoney(BigDecimal money, Locale locale)
format Money
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());
return new DecimalFormat("#0.00").format(money);
StringformatMoney(BigDecimal value)
Mascara texto com formatacao monetaria
NumberFormat money = NumberFormat.getCurrencyInstance(new Locale("pt", "BR"));
if (value != null) {
    return money.format(value);
return money.format(0);
StringformatMoney(double cents, Locale locale)
format Money
cents /= 100;
DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
DecimalFormat format = new DecimalFormat("#,##0.00", symbols);
return format.format(cents);
StringformatMoney(double dtSource)
format Money
java.text.DecimalFormat formatter = new java.text.DecimalFormat("#,###.00");
return "??" + formatter.format(dtSource);