I want to generate a sequence number starting from 00000001,00000002....(i need all these zero as well)Please help me..Thanks in advance..
3 Answers
You can just generate the sequence numbers as integers and then format them like this:
String.format("%08d", yournumber);
See this question: How can I pad an integers with zeros on the left?
Comments
You just need to use string formatting to pad numbers with zeros:
for (int i = 1; i < 1000; i++) {
String sequence = String.format("%08d", i);
}