Given a ISO 3166-1 country code, what is the best possible way to get the corresponding ISO 4217 currency code in Java? For example, for the country code 'US' I should get the corresponding currency code 'USD'.
Is there any library or utility class providing such facility in Java? I had a look at the Currency class in java but, that gives the currency code for a given locale. Thanks!
Joined: May 06, 2003
Thinking about it, I found a solution and is given below:
In this code, I am constructing a new Locale with the correct ISO country code for France(FR) and the wrong language(en). I am pssing this Locale instance to the Currency class and thereby, obtaining the Currency Code for the given country.
Is there any problem by constructing a Locale instance by passing a wrong langauge? Thanks!