"fr", "FR", "PREEURO", "1,50\u00a0F",
};
for (int i=0; i<DATA.length; i+=4) {
Locale locale = new Locale(DATA[i], DATA[i+1], DATA[i+2]);
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
String s = fmt.format(1.50);
if (s.equals(DATA[i+3])) {
logln("Ok: 1.50 x " + locale + " => " + s);
} else {
logln("FAIL: 1.50 x " + locale + " => " + s +
", expected " + DATA[i+3]);
}
}
// format currency with CurrencyAmount
for (int i=0; i<DATA.length; i+=4) {
Locale locale = new Locale(DATA[i], DATA[i+1], DATA[i+2]);
Currency curr = Currency.getInstance(locale);
logln("\nName of the currency is: " + curr.getName(locale, Currency.LONG_NAME, new boolean[] {false}));
CurrencyAmount cAmt = new CurrencyAmount(1.5, curr);
logln("CurrencyAmount object's hashCode is: " + cAmt.hashCode()); //cover hashCode
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
String sCurr = fmt.format(cAmt);
if (sCurr.equals(DATA[i+3])) {
logln("Ok: 1.50 x " + locale + " => " + sCurr);
} else {
errln("FAIL: 1.50 x " + locale + " => " + sCurr +
", expected " + DATA[i+3]);