Java Program Number to Word

2 May 2025 | 11 min read

In this section, we will create a Java program that converts the given number into words. For example, if the given number is 54,297 then the output should be Fifty-Four Thousand Two Hundred Ninety-Seven. Let's create a Java program for the same.

NumberToWordExample1.java

Output:

Java Program Number to Word

The number is not limited to four digits. Then what if the user enters more than 5 five digits numbers. The above program does not work for large digit numbers.

Converting Large Numbers into Words

The logic for converting the large digit numbers is quite different. Let's see the approach to convert large digits numbers.

NumberToWordExample2.java

Output:

Java Program Number to Word

Converting Very Long Numbers into Words

The logic for the conversion of very long numbers into words is different from the previous one. Before moving ahead, it is important to learn the name of large numbers. The following table describes the name of the larger numbers.

NameShort Scale
(US, English Canada, modern British, Australia, and Eastern Europe)
Long Scale
(French Canada, older British, Western & Central Europe)
Million106106
MilliardNot used109
Billion1091012
BilliardNot used1015
Trillion10121018
Quadrillion10151024
Quintillion10181030
Sextillion10211036
Septillion10241042
Octillion10271048
Nonillion10301054
Decillion10331060
Undecillion10361066
Duodecillion10391072
Tredecillion10421078
Quattuordecillion10451084
Quindecillion10481090
Sexdecillion10511096
Septendecillion105410102
Octodecillion105710108
Novemdecillion106010114
Vigintillion106310120
Centillion1030310600

Let's create a Java program that converts very long numbers into words.

The following Java program also converts the negative and decimal numbers into words.

NumberToWordExample3.java

Output:

0 = zero 4 = four 10 = ten 12 = twelve 100 = one hundred 108 = one hundred eight 299 = two hundred ninety-nine 1000 = one thousand 1003 = one thousand three 2040 = two thousand forty 45213 = forty-five thousand two hundred thirteen 100000 = one hundred thousand 100005 = one hundred thousand five 100010 = one hundred thousand ten 202020 = two hundred two thousand twenty 202022 = two hundred two thousand twenty-two 999999 = nine hundred ninety-nine thousand nine hundred ninety-nine 1000000 = one million 1000001 = one million one 10000000 = ten million 10000007 = ten million seven 99999999 = ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-nine 9223372036854775807 = nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred seven -9223372036854775808 = minus nine quintillion two hundred twenty-three quadrillion three hundred seventy-two trillion thirty-six billion eight hundred fifty-four million seven hundred seventy-five thousand eight hundred eight 0001.2 = one and two tenth 3.141592 = three and one hundred forty-one thousand five hundred ninety-two millionth 

Even, we can convert 100 digits long number with the help of the above program.