char val;
int idx = 1;
do {
if (PasswordGenerator.matchCharAt (val, idx))
System.out.println("The Password is " + password);
idx++;
} while (idx < 127 );
I’m suppose to tests if the character parameter matches the character in the password at the specified index. There may be a lot of things that are wrong with just that because I’ve been messing with it for 2 hours.
Then I need to append them with stringbuilder together (which I’m not worried about) and display the characters to the screen (I’m also not worried about that).
I have no idea how to loop them to check the ascii letters from 0-127. So I need help trying to figure that out.
This is the documentation for PasswordGenerator.
I’m trying to get the Password to display random letters within my password (pretty much or at least I think). This is what I did to get the password length…
int length=0;
int MaxNumber=100;
StringBuilder password = new StringBuilder();
do {
if (PasswordGenerator.matchLength (length))
System.out.println("The length of the character is " + length);
length++; // length is randomly picked
} while (length < MaxNumber ); // or <100
A char is a primitive type – you can iterate with it just like any number. for example:
In your case, you might limit the values to between 0 and 127, according to whatever you’ve been given, but a char is effectively a numeric type.