File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Converting numbers to word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Converting numbers to word" Watch "Converting numbers to word" New topic

Converting numbers to word

namrata mahajan

Joined: Jan 08, 2009
Posts: 6
Hii guys,
i am new to this forum. Can anybody give me an idea about how to convert a number into word e.g. if a number is 7932 then in word it will be seven thousand nine hundred and thirty two.
Ankit Garg

Joined: Aug 03, 2008
Posts: 9453

Well I don't think there is no direct way to do this. You will have to write a small program that uses % 10 to extract the last digit, then according to the position of the digit, add hundred or thousand and then divide the number by 10 and then again uses %10.

This question is not related to SCJP so post it in the Java-General-beginner forum

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Converting numbers to word
It's not a secret anymore!