4
I have to create a bank account with some requirements, in the middle of them I need to have a 5 digit starting number of the 00001.
But when putting "00001" at the time of displaying only displays the 2, 3 onwards. my solution was to use the number 10000. But I wanted to know how to do according to the statement.
public abstract class Account implements IBaseRate {
String name;
String sSN;
double balence;
String accountNumber;
double rate;
static int index = 00001;
...
private String setAccountNumber() {
String lastSSN = sSN.substring(sSN.length()-2, sSN.length());
int uniqueID = index++;
int randomNumber = (int) (Math.random()*Math.pow(10, 3));
return lastSSN + uniqueID + randomNumber;
}
}
00001 is a number of one digit formatted with zeros on the left.
– Jéf Bueno