Is there a way to get a text description of the currency represented by a Currency object in Java?
i.e. I have AZM, I want Azerbaijan Manat
The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. For example: The US dollar is represented as USD – the US coming from the ISO 3166 country code and the D for dollar.
The official ISO 4217 standard specifies three-letter ("Alpha-3") codes for currencies worldwide. The first two letters of these codes are usually identical with the two-letter ISO 3166-1 Alpha-2 country codes, which are well-known by internet users, as they are used for country domain suffixes.
getInstance() : java. util. Currency. getInstance() method creates currency instance for Currency code.
1 Answer. Java has Currency class that represents the ISO 4217 currency codes. BigDecimal is the best type for representing currency decimal values.
Such a mapping would again be Locale
-dependent… I think your best bet would be to take a long, hard look at ISO 4217 and create a Map
from currency code to currency name.
It's not supported by Java but a few libraries can do this.
My number one choice would be ICU,
http://icu-project.org/apiref/icu4j/com/ibm/icu/util/Currency.html#getName%28java.util.Locale,%20int,%20boolean[]%29
This call can get you the name of a currency in multiple locales. ICU also supports all other i18n features not available in JRE. However, it's pretty big.
Another option is jPOS,
http://gl.jpos.org/
If you do anything with financial data, this is the de-facto standards. Watch for its license. Our lawyers didn't like it for some reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With