public String toString() { NumberFormat nf = NumberFormat.getCurrencyInstance(); Currency cur = currency.getCurrency(); if (cur == null) { return "Money()"; } nf.setCurrency(cur); String c = nf.format(cents / (Math.pow(10, currency.getDefaultFractionDigits()))); return "Money(" + c + ")"; }
@Override public int hashCode() { return currency.hashCode() * 31 + cents; }