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

StringformatMoney(double money, int scalar)
format Money
String zero = "000000000000000000000000000000";
String format = "###,##0." + zero.substring(0, scalar);
NumberFormat nf = new DecimalFormat(format);
return nf.format(money);
StringformatMoney(int dosh)
format Money
String ret = CURRENCY_SYMBOL + String.valueOf(dosh);
return ret;
doubleformatMoney(Object str)
format Money
DecimalFormat df = new DecimalFormat("0.00");
return Double.valueOf(df.format(str)).doubleValue();
StringformatMoney(String money)
format Money
if (money == null)
    return "";
try {
    money = money.trim();
    double d = Double.parseDouble(money);
    return formatMoney(d);
} catch (Exception e) {
    System.err.println(e);
...
StringformatMoneyNoSymbol(int pennies)
format Money No Symbol
return String.format("%.2f", ((double) pennies / 100));
StringformatMoneyShort(int pennies)
format Money Short
if (pennies % 100 == 0) {
    return "£" + (pennies / 100);
} else {
    return formatMoney(pennies);
StringformatMoneyVI(String money)
format Money VI
try {
    java.text.DecimalFormat df = new java.text.DecimalFormat("#,##0.00");
    return df.format(Double.parseDouble(money));
} catch (NumberFormatException e) {
return null;
StringformatOfRead(BigDecimal money)
format Of Read
DecimalFormat format = new DecimalFormat("###,##0.00");
format.setRoundingMode(RoundingMode.HALF_UP);
return format.format(money);
StringformatThousandMoney(String moneyStr)
format Thousand Money
int money = Integer.valueOf(moneyStr).intValue();
return money == 0 ? "" : Integer.toString(money);
StringgetMoneyFormat(double money)
get Money Format
DecimalFormat df = new DecimalFormat("#,##0.00");
return df.format(money);