# Number generation

michael yue

Ranch Hand

Posts: 204

posted 12 years ago

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.

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

Posts: 51

posted 12 years ago

Look at the API specification for java.text.DecimalFormat.

Mark Patrick<br />SCJP 1.4