Java Utililty Methods Money

List of utility methods to do Money

Description

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

Method

floatmoneyMinus(float a, float b)
money Minus
final int intA = (int) (100 * a);
final int intB = (int) (100 * b);
final int intResult = intA - intB;
final float result = intResult / 100.0f;
return result;
IntegermultiMoney(Integer money)
multi Money
if (money == null)
    return 0;
else {
    return money * rate;
Stringstring2Money(String money)
string Money
if (money.matches("[0-9]{12,}")) {
    money = money.substring(0, money.length() - 2) + "." + money.substring(money.length() - 2);
    return money.replaceAll("^0+(?!$)", "");
} else {
    return null;
StringtranslateMoneyStr(String money)
translate Money Str
if (money == null || money.length() == 0) {
    return money;
StringBuffer sb = new StringBuffer();
int len = money.length();
int count = len / 3;
int del = len % 3;
sb.append(money.substring(0, del));
...