I have developed an application to develop an auto generated alphanumberic string for my project. In this string, the first three chars are alphabetical and the next seven are integers.
public class AlphaNumericGenerator {
public static void main(String[] args) {
java.util.Random r = new java.util.Random();
int i = 1, n = 0;
char c;
String str="";
for (int t = 0; t < 3; t++) {
while (true) {
i = r.nextInt(10);
if (i > 5 && i < 10) {
if (i == 9) {
i = 90;
n = 90;
break;
}
if (i != 90) {
n = i * 10 + r.nextInt(10);
while (n < 65) {
n = i * 10 + r.nextInt(10);
}
}
break;
}
}
c=(char)n;
str= String.valueOf(c)+str;
}
while(true){
i = r.nextInt(10000000);
if(i>999999)
break;
}
str=str+i;
System.out.println(str);
}
}