java.util.Currency getNumericCode()


The getNumericCode() method of Currency class is use to get the ISO 4217 currency code of this currency.

Method Syntax

public int getNumericCode()

Method Argument

Data Type Parameter Description

Method Returns

The getNumericCode() method of Currency class returns the ISO 4217 numeric code of this currency


Java 1.7

Java Currency getNumericCode() Example

Below is a simple java example on the usage of getNumericCode() method of Currency class.


import static java.lang.System.*;

import java.util.Currency;
import java.util.Set;

 * This example source code demonstrates the use of 
 * getNumericCode() method of Currency class.

public class CurrencyGetNumericCodeExample {

	public static void main(String[] args) {

		// get all available currencies
		Set setCurrency = Currency.getAvailableCurrencies();
		// print details on all the currency
		for (Currency currency : setCurrency) {
			out.println(currency.getNumericCode() + "-"
					+ currency.getDisplayName());

Basically on the above example, we have enumerated all the Currencies together with their numeric code.

Sample Output

Below is the sample output when you run the above example.

Currency getNumericCode Sample Output