okay so i'm making a password checker program and there's a few rules. the password must be 8 or more characters the password must contain 2 or more digits the password can only be letters and numbers here is what i have so far how do i check for 2 digits and for only letters and numbers? thanks
import java.util.Scanner;
public class checkPassword {
    public static boolean passwordLength(String password) {
        boolean correct = true;
        int digit = 0; 
        if (password.length() < 8) {
            correct = false;
        }
        return correct;
    }
    public static void main(String[] args) {
        // Nikki Kulyk
        //Declare the variables
        String password;
        Scanner input = new Scanner(System.in);
        //Welcome the user
        System.out.println("Welcome to the password checker!");
        //Ask the user for input
        System.out.println("Here are some rules for the password because we like to be complicated:\n");
        System.out.println("A password must contain at least eight characters.\n" +
                "A password consists of only letters and digits.\n" +
                "A password must contain at least two digits.\n");
        System.out.println("Enter the password: ");
        password = input.nextLine();
        boolean correct = passwordLength(password);
        if (correct) {
            System.out.println("Your password is valid.");
        }
        else {
            System.out.println("Your password is invalid.");
        }
    }
}
 
     
     
     
     
     
    