If entered password is valid or not using Method

 import java.util.*;


public class CheckPassword {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);

System.out.println("1. A password must have at least eight characters.\n" +
"2. A password consists of only letters and digits.\n" +
"3. A password must contain at least two digits." +
"Input a password (You are agreeing to the above Terms and Conditions.) : ");

String str = sc.nextLine();

if (valid_Password(str)) {
System.out.println("Entered password is a valid password");
} else {
System.out.println("Entered password is not a valid password");
}

}

public static boolean valid_Password(String password) {
if (password.length() < 8) {
return false;
}
int charCount = 0;
int numCount = 0;

for (int i = 0; i < password.length(); i++) {
char ch = password.charAt(i);

if (check_Numeric(ch)) {
numCount++;
} else if (check_Character(ch)) {
charCount++;
} else {
return false;
}
}
return (numCount >= 2 && charCount >= 2);

}

public static boolean check_Character(char ch) {
ch = Character.toUpperCase(ch);
return (ch >= 'A' && ch <= 'Z');
}

public static boolean check_Numeric(char ch) {
return (ch >= 0 && ch <= 9);
}
}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...