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++;
}
}
}
}
So I have found how to find the first character of my randomly generated password via loop, and was wondering how I could provide it to find the other characters in the password by using either that loop or another. The characters follow how long the loop is which is also randomly generated. The documentation to the PasswordGenerator class is here.. (http://www.technology.heartland.edu/faculty/todds/csci130/assignments/A5_password/doc/index.html)
Change the value of
indexto the position of the character you are trying to find. If you want to find all of them then…