Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/util/Currency#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/util/Currency#inhmethods)

# Currency

` public final class Currency `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/io/Serializable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.Currency |

<br />

*** ** * ** ***

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.

It is recommended to use `https://developer.android.com/reference/java/math/BigDecimal` class while dealing with `Currency` or monetary values as it provides better handling of floating point numbers and their operations.
**See also:**

- `https://developer.android.com/reference/java/math/BigDecimal`

## Summary

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/util/Currency>` | ` https://developer.android.com/reference/java/util/Currency#getAvailableCurrencies()() ` Gets the set of available currencies. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getCurrencyCode()() ` Gets the ISO 4217 currency code of this currency. |
| ` int` | ` https://developer.android.com/reference/java/util/Currency#getDefaultFractionDigits()() ` Gets the default number of fraction digits used with this currency. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getDisplayName()() ` Gets the name that is suitable for displaying this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#DISPLAY` locale. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getDisplayName(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` Gets the name that is suitable for displaying this currency for the specified locale. |
| ` static https://developer.android.com/reference/java/util/Currency` | ` https://developer.android.com/reference/java/util/Currency#getInstance(java.lang.String)(https://developer.android.com/reference/java/lang/String currencyCode) ` Returns the `Currency` instance for the given currency code. |
| ` static https://developer.android.com/reference/java/util/Currency` | ` https://developer.android.com/reference/java/util/Currency#getInstance(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` Returns the `Currency` instance for the country of the given locale. |
| ` int` | ` https://developer.android.com/reference/java/util/Currency#getNumericCode()() ` Returns the ISO 4217 numeric code of this currency. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getNumericCodeAsString()() ` Returns the 3 digit ISO 4217 numeric code of this currency as a `String`. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getSymbol(java.util.Locale)(https://developer.android.com/reference/java/util/Locale locale) ` Gets the symbol of this currency for the specified locale. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#getSymbol()() ` Gets the symbol of this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#DISPLAY` locale. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/util/Currency#toString()() ` Returns the ISO 4217 currency code of this currency. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### getAvailableCurrencies

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Set<Currency> 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.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/util/Currency>` | the set of available currencies. If there is no currency available in the runtime, the returned set is empty. <br /> |

### getCurrencyCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getCurrencyCode ()
```

Gets the ISO 4217 currency code of this currency.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the ISO 4217 currency code of this currency. <br /> |

### getDefaultFractionDigits

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getDefaultFractionDigits ()
```

Gets the default number of fraction digits used with this currency. Note that the number of fraction digits is the same as ISO 4217's minor unit for the 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.

<br />

| Returns ||
|---|---|
| `int` | the default number of fraction digits used with this currency <br /> |

### getDisplayName

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDisplayName ()
```

Gets the name that is suitable for displaying this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#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://developer.android.com/reference/java/util/Currency#getDisplayName(java.util.Locale)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the display name of this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#DISPLAY` locale <br /> |

### getDisplayName

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getDisplayName (Locale 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.

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: the locale for which a display name for this currency is needed <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the display name of this currency for the specified locale <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `locale` is null |

### getInstance

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Currency getInstance (String currencyCode)
```

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

<br />

| Parameters ||
|---|---|
| `currencyCode` | `String`: the ISO 4217 code of the currency <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Currency` | the `Currency` instance for the given currency code <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `currencyCode` is not a supported ISO 4217 code. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `currencyCode` is null |

### getInstance

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Currency getInstance (Locale 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.

If the specified `locale` contains "cu" [ERROR(Unicode extensions/java.util.Locale##def_locale_extension Unicode extensions)](https://developer.android.com/), the instance returned from this method reflects the values specified with those extensions.

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

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: the locale for whose country a `Currency` instance is needed <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Currency` | the `Currency` instance for the country of the given locale, or `null` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the country of the given `locale` is not a supported ISO 3166 country code. |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `locale` is `null` |

### getNumericCode

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getNumericCode ()
```

Returns the ISO 4217 numeric code of this currency.

<br />

| Returns ||
|---|---|
| `int` | the ISO 4217 numeric code of this currency <br /> |

### getNumericCodeAsString

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getNumericCodeAsString ()
```

Returns the 3 digit ISO 4217 numeric code of this currency as a `String`. Unlike `https://developer.android.com/reference/java/util/Currency#getNumericCode()`, which returns the numeric code as `int`, this method always returns the numeric code as a 3 digit string. e.g. a numeric value of 32 would be returned as "032", and a numeric value of 6 would be returned as "006".

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the 3 digit ISO 4217 numeric code of this currency as a `String` <br /> |

### getSymbol

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getSymbol (Locale 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.

<br />

| Parameters ||
|---|---|
| `locale` | `Locale`: the locale for which a display name for this currency is needed <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the symbol of this currency for the specified locale <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `locale` is null |

### getSymbol

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getSymbol ()
```

Gets the symbol of this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#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://developer.android.com/reference/java/util/Currency#getSymbol(java.util.Locale)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the symbol of this currency for the default `https://developer.android.com/reference/java/util/Locale.Category#DISPLAY` locale <br /> |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns the ISO 4217 currency code of this currency.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the ISO 4217 currency code of this currency <br /> |