public class Driver {
public static void main(String[] args) {
int length=0;
int MaxNumber=100;
StringBuilder password = new StringBuilder();
do {
if (PasswordGenerator.matchLength (length)) {
break;
}
length++; // length is randomly picked
} while (length < MaxNumber ); // or <100
System.out.println("The length of the character string is " + length);
int index = 0;
char f = 0;
for (char d = 0; d < 127; d++) {
if(PasswordGenerator.matchCharAt(d, index)) {
password.append(d);
System.out.println("Hey! Char at " + index + " is " + d);
d++;
}
}
}
}
所以我找到了如何通过循环找到我随机生成的密码的第一个字符,并且想知道如何通过使用该循环或另一个循环来提供它来查找密码中的其他字符。字符跟随循环的长度,这也是随机生成的。PasswordGenerator 类的文档在这里.. (http://www.technology.heartland.edu/faculty/todds/csci130/assignments/A5_password/doc/index.html)