Hi Bin,
For me, it appears your requirement is to use a NumberRange.
There is already an excellent blog article by Horst regarding how to use the NumberRange reuse library.
Check it out here: http://scn.sap.com/docs/DOC-56177
I hope this solves your requirement.
Best regards,
Ludger