Java Utililty Methods Currency Code Get

List of utility methods to do Currency Code Get

  1. HOME
  2. Java
  3. C
  4. Currency Code Get

Description

The list of methods to do Currency Code Get are organized into topic(s).

Method

List countryCodesForCurrency(String c)
country Codes For Currency
Set<String> codes = new HashSet<>();
if (isValidCode(c)) {
 for (Locale l : Locale.getAvailableLocales()) {
 try {
 Currency currentCurrency = Currency.getInstance(l);
 if (currentCurrency.getCurrencyCode().equals(c)) {
 codes.add(l.getCountry());
 } catch (IllegalArgumentException e) {
return new ArrayList<>(codes);
Currency currencyFromCode(String currency)
currency From Code
try {
 return Currency.getInstance(currency);
} catch (IllegalArgumentException e) {
 return null;
String[] getAvaiableCurrencySymbols()
Returns all the currency symbols
if (_allCurrencySymbols == null) {
 Locale[] locals = Locale.getAvailableLocales();
 ArrayList list = new ArrayList();
 for (int i = 0; i < locals.length; i++) {
 list.add(NumberFormat.getInstance(locals[i]).getCurrency().getSymbol(locals[i]));
 _allCurrencySymbols = (String[]) list.toArray(new String[list.size()]);
 return _allCurrencySymbols;
...
Currency getCurrency(final String code)
get Currency
return Currency.getInstance(code);
String getCurrencyDisplay(Object amount)
get Currency Display
String display = "";
try {
 if (amount != null && !isEmpty(amount))
 display = NumberFormat.getCurrencyInstance().format(amount);
} catch (IllegalArgumentException ie) {
return display;
String getCurrencyNationNumber(double num, int dec)
get Currency Nation Number
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.CHINA);
nf.setMaximumFractionDigits(dec);
return nf.format(num);
String getCurrencyString(long value)
get Currency String
NumberFormat numberFormat = DecimalFormat.getIntegerInstance();
String text = numberFormat.format(value) + " C-Bills";
return text;
Currency getDefaultCurrency()
get Default Currency
return NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency();
Currency getInstance(String currencyCode)
get Instance
try {
 return Currency.getInstance(currencyCode);
} catch (Exception e) {
 return Currency.getInstance(Locale.US);


AltStyle によって変換されたページ (->オリジナル) /