Im writing a program to check for values in a password given by the user. I have posted the code below and I think its all good I'm just confused on how the syntax for the boolean check in the if statement should be checked. Any help is appreciated, thanks!
public class PasswordValidation
{
public static void main(String[] args){
Scanner stdin = new Scanner(System.in);
System.out.println("Password: ");
String password = stdin.next();
int passwordLength = password.length();
String pCheck = "password";
boolean capital;
boolean lowercase;
boolean number;
boolean specialChar;
char check;
for(int i = 0; i < password.length(); i++){
check = password.charAt(i);
if(Character.isDigit(check)){
number = true;
}else if (Character.isUpperCase(check)){
capital = true;
}else if (Character.isLowerCase(check)){
lowercase = true;
}else{
specialChar = true;
}
}
if(number = true && capital = true && lowercase = true && specialChar = false && password.length() >= 8 && password.toLowerCase().contains(pCheck.toLowerCase())){
System.out.println("Password is good");