# Currency

public final class **Currency** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) Represents a currency. Currencies are identified by their ISO 4217 currency
codes. Visit the [ISO web site](http://www.iso.org/iso/home/standards/currency_codes.htm) for more information.


The class is designed so that there's never more than one
`Currency` instance for any given currency. Therefore, there's
no public constructor. You obtain a `Currency` instance using
the `getInstance` methods.

### Public Method Summary

|---|---|
| static [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html)\> | [getAvailableCurrencies](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getAvailableCurrencies())() Gets the set of available currencies. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getCurrencyCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getCurrencyCode())() Gets the ISO 4217 currency code of this currency. |
| int | [getDefaultFractionDigits](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getDefaultFractionDigits())() Gets the default number of fraction digits used with this currency. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getDisplayName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getDisplayName())() Gets the name that is suitable for displaying this currency for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getDisplayName](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getDisplayName(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Gets the name that is suitable for displaying this currency for the specified locale. |
| static [Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html) | [getInstance](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getInstance(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) currencyCode) Returns the `Currency` instance for the given currency code. |
| static [Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html) | [getInstance](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getInstance(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Returns the `Currency` instance for the country of the given locale. |
| int | [getNumericCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getNumericCode())() Returns the ISO 4217 numeric code of this currency. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSymbol](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getSymbol(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Gets the symbol of this currency for the specified locale. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSymbol](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getSymbol())() Gets the symbol of this currency for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#toString())() Returns the ISO 4217 currency code of this currency. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Methods

#### public static [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html)\>
**getAvailableCurrencies**
()

Gets the set of available currencies. The returned set of currencies
contains all of the available currencies, which may include currencies
that represent obsolete ISO 4217 codes. The set can be modified
without affecting the available currencies in the runtime.

##### Returns

- the set of available currencies. If there is no currency available in the runtime, the returned set is empty.

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getCurrencyCode**
()

Gets the ISO 4217 currency code of this currency.

##### Returns

- the ISO 4217 currency code of this currency.

#### public int
**getDefaultFractionDigits**
()

Gets the default number of fraction digits used with this currency.
For example, the default number of fraction digits for the Euro is 2,
while for the Japanese Yen it's 0.
In the case of pseudo-currencies, such as IMF Special Drawing Rights,
-1 is returned.

##### Returns

- the default number of fraction digits used with this currency

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getDisplayName**
()

Gets the name that is suitable for displaying this currency for
the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale.
If there is no suitable display name found
for the default locale, the ISO 4217 currency code is returned.


This is equivalent to calling
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getDisplayName(java.util.Locale)`.

##### Returns

- the display name of this currency for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getDisplayName**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Gets the name that is suitable for displaying this currency for
the specified locale. If there is no suitable display name found
for the specified locale, the ISO 4217 currency code is returned.

##### Parameters

| locale | the locale for which a display name for this currency is needed |
|---|---|

##### Returns

- the display name of this currency for the specified locale

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `locale` is null |
|---|---|

#### public static [Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html)
**getInstance**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) currencyCode)

Returns the `Currency` instance for the given currency code.

##### Parameters

| currencyCode | the ISO 4217 code of the currency |
|---|---|

##### Returns

- the `Currency` instance for the given currency code

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `currencyCode` is null |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `currencyCode` is not a supported ISO 4217 code. |
|---|---|

#### public static [Currency](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html)
**getInstance**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Returns the `Currency` instance for the country of the
given locale. The language and variant components of the locale
are ignored. The result may vary over time, as countries change their
currencies. For example, for the original member countries of the
European Monetary Union, the method returns the old national currencies
until December 31, 2001, and the Euro from January 1, 2002, local time
of the respective countries.


The method returns `null` for territories that don't
have a currency, such as Antarctica.

##### Parameters

| locale | the locale for whose country a `Currency` instance is needed |
|---|---|

##### Returns

- the `Currency` instance for the country of the given locale, or `null`

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `locale` or its country code is `null` |
| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the country of the given `locale` is not a supported ISO 3166 country code. |
|---|---|

#### public int
**getNumericCode**
()

Returns the ISO 4217 numeric code of this currency.

##### Returns

- the ISO 4217 numeric code of this currency

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getSymbol**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Gets the symbol of this currency for the specified locale.
For example, for the US Dollar, the symbol is "$" if the specified
locale is the US, while for other locales it may be "US$". If no
symbol can be determined, the ISO 4217 currency code is returned.

##### Parameters

| locale | the locale for which a display name for this currency is needed |
|---|---|

##### Returns

- the symbol of this currency for the specified locale

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `locale` is null |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getSymbol**
()

Gets the symbol of this currency for the default
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale.
For example, for the US Dollar, the symbol is "$" if the default
locale is the US, while for other locales it may be "US$". If no
symbol can be determined, the ISO 4217 currency code is returned.


This is equivalent to calling
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Currency.html#getSymbol(java.util.Locale)`.

##### Returns

- the symbol of this currency for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#DISPLAY` locale

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns the ISO 4217 currency code of this currency.

##### Returns

- the ISO 4217 currency code of this currency