wood burning stoves 2.0*
The moose likes Java in General and the fly likes Number generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Number generation" Watch "Number generation" New topic
Author

Number generation

michael yue
Ranch Hand

Joined: Nov 20, 2003
Posts: 204
Hi all,

I dont know how to come up with the simplest algorithm for this problem.
I want to generate a range of numbers if the front of the numbers begin with 0.
Example start number is 001 and end number is 008
then it will generate 001,002,003 and so on till 008.

Also i am a bit stumped on preventing wrong input generation for example when first number input 001 but end number input 0005.
Thanks a lot. Hope i am clear enough.
Mark Patrick
Ranch Hand

Joined: Feb 22, 2004
Posts: 51
Look at the API specification for java.text.DecimalFormat.


Mark Patrick<br />SCJP 1.4
Mark Patrick
Ranch Hand

Joined: Feb 22, 2004
Posts: 51
This will do the trick:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Number generation