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)循環通過生成的字符
那'PasswordGenerator'的事情是非常不好的,它應該能夠至少給你的密碼長度不強迫你遍歷整個事情。 – debracey