Java Currency getNumericCodeAsString() Method

8 Nov 2024 | 2 min read

The getNumericCodeAsString() is the method of Java Currency class which is used to get the 3 digit numeric code (as defined by ISO 4217) for the invoking currency as a String. For example, Numeric value of 20 would be returned as "020", and a numeric value of 1 would be returned as "001".

Syntax

Following is the declaration of getNumericCodeAsString() method:

Parameter

DataTypeParameterDescription
NANAThis method does not accept any parameter.

Returns

The getNumericCodeAsString() method returns the 3 digit numeric code (as defined by ISO 4217) for the invoking currency as a String.

Exceptions

NA

Compatibility Version

Java 9 and above

Example 1

Output:

044 - Bahamian Dollar 064 - Bhutanese Ngultrum 788 - Tunisian Dinar 051 - Armenian Dram 442 - Luxembourgian Franc 963 - Testing Currency Code 000 - French Gold Franc 952 - West African CFA Franc 970 - Colombian Real Value Unit 380 - Italian Lira 760 - Syrian Pound 784 - United Arab Emirates Dirham 524 - Nepalese Rupee 108 - Burundian Franc 144 - Sri Lankan Rupee 124 - Canadian Dollar 752 - Swedish Krona ... 

Example 2

Output:

Name: British Pound Sterling Numeric Code: 826 

Example 3

Output:

Enter the numeric code which you want to search: 020 Currency with Numeric code 020 is found. Enter the numeric code which you want to search: 111 Currency with Numeric code 111 not found. 

Example 4

Output:

Enter the Currency: ADP Name: Andorran Peseta Numeric Code: 020