jQuery in Action, 3rd edition
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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Number generation" Watch "Number generation" New topic

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Number generation
It's not a secret anymore!