This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Integer to word for the number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Integer to word for the number" Watch "Integer to word for the number" New topic

Integer to word for the number

Angel Dobbs-Sciortino
Ranch Hand

Joined: Sep 10, 2003
Posts: 101
Is there a class in the API that will convert an integer into the word for that number? Such as one, two, three, etc.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
Hi Angel
Not that I know of in Java API.
Can't you just write your own class if you just have single digit numbers to manipulate? If you have 123 and you want to have "one hundred and twenty three" then its little difficult I guess but if you have one digit numbers then you can just define mapping right?
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Hello ,
I wrote a method which does exactly what you want to do in a calculator assignment for my degree. At the moment I don't have it the at the place I am writting this anser. But if you want I will defenetely give you the coding when I go home. My coding translates 9 decimal numbers and 3 floating point numbers.

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Angel Dobbs-Sciortino
Ranch Hand

Joined: Sep 10, 2003
Posts: 101
Yes, I would be interested in seeing that method. I've made my own method for now, but I would like to see another implementation of it.
I agree. Here's the link:
subject: Integer to word for the number
It's not a secret anymore!