File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Formatting a numeric value (123,456) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Formatting a numeric value (123,456)" Watch "Formatting a numeric value (123,456)" New topic

Formatting a numeric value (123,456)

Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
Hello, fellow ranchers. Is there a class or a method provided that will format a numeric value from 123456 to 123,456?

<b>Donald Nunn</b><br />Sun Certified Programmer for the Java 2 Platform
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Yup - java.text.DecimalFormat.

"I'm not back." - Bill Harding, Twister
Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
Thanks, Jim for that great suggestion. I did get it to work and it looks great. Thanks, again.
It is sorta covered in the JavaRanch Style Guide.
subject: Formatting a numeric value (123,456)