Пример #1
0
 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 + ")";
 }
Пример #2
0
 @Override
 public int hashCode() {
   return currency.hashCode() * 31 + cents;
 }