title: getting currency code if we have only country code in database
body: <p>i have problem getting the country currency, i am having the country code in database through these code i have to get the country code in java how do i make the code for this please suggest me.
  i m trying with this example but its not working.</p>
  
  <pre><code>    class Utils {
      public static SortedMap&lt;Currency, Locale&gt; currencyLocaleMap;
      static {
          currencyLocaleMap = new TreeMap&lt;Currency, Locale&gt;(
                  new Comparator&lt;Currency&gt;() {
                      public int compare(Currency c1, Currency c2) {
                          return c1.getCurrencyCode().compareTo(
                                  c2.getCurrencyCode());
                      }
                  });
          for (Locale locale : Locale.getAvailableLocales()) {
              try {
                  Currency currency = Currency.getInstance(locale);
                  currencyLocaleMap.put(currency, locale);
              } catch (Exception e) {
              }
          }
      }
  
      public static String getCurrencySymbol(String currencyCode) {
          Currency currency = Currency.getInstance(currencyCode);
          System.out.println(currencyCode + ":-"
                  + currency.getSymbol(currencyLocaleMap.get(currency)));
          return currency.getSymbol(currencyLocaleMap.get(currency));
      }
  }
  
    public class GetCurrency {
      public static void main(String[] args) {
  
          Utils.getCurrencySymbol(Currency.getInstance("INR").getCurrencyCode());
          Utils.getCurrencySymbol(Currency.getInstance(Locale.JAPAN)
                  .getCurrencyCode());
          Utils.getCurrencySymbol(Currency.getInstance(Locale.UK)
                  .getCurrencyCode());
  
          Utils.getCurrencySymbol("INR");
      }
  }
  </code></pre>