/**
 * A class to check if a password is strong.
 * There are 5 rules to check if a password is strong:
 * 1. Must contain at least 8 characters.
 * 2. Must contain at least one uppercase letter.
 * 3. Must contain at least one lowercase letter.
 * 4. Must contain at least one number.
 * 5. Must contain at least one special character (from `!@#$%^&*()`).
 */
public class StrongPassword {

    private static final String SPECIAL_CHARS = "!@#$%^&*()";

    /**
     * Check if the password has at least 8 characters.
     *
     * @param password the password
     * @return true if the password has at least 8 characters, false otherwise
     */
    public static boolean checkLen(String password) {
        return password.length() >= 8;
    }

    /**
     * Check if the password has at least one uppercase letter.
     *
     * @param password the password
     * @return true if the password has at least one uppercase letter, false otherwise
     */
    public static boolean checkUppercase(String password) {
        for (char c : password.toCharArray()) {
            if (Character.isUpperCase(c)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Check if the password has at least one lowercase letter.
     *
     * @param password the password
     * @return true if the password has at least one lowercase letter, false otherwise
     */
    public static boolean checkLowercase(String password) {
        for (char c : password.toCharArray()) {
            if (Character.isLowerCase(c)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Check if the password has at least one number.
     *
     * @param password the password
     * @return true if the password has at least one number, false otherwise
     */
    public static boolean checkNumber(String password) {
        for (char c : password.toCharArray()) {
            if (Character.isDigit(c)) {
                return true;
            }
        }
        return false;
    }

    /**
     * Check if the password has at least one special character.
     *
     * @param password the password
     * @return true if the password has at least one special character, false otherwise
     */
    public static boolean checkSpecialChar(String password) {
        for (char c : password.toCharArray()) {
            if (SPECIAL_CHARS.indexOf(c) >= 0) {
                return true;
            }
        }
        return false;
    }

    /**
     * Check if the password is strong.
     * To be strong, the password must satisfy the 5 rules.
     *
     * @param password the password
     * @return true if the password is strong, false otherwise
     */
    public static boolean isStrong(String password) {
        return checkLen(password)
                && checkUppercase(password)
                && checkLowercase(password)
                && checkNumber(password)
                && checkSpecialChar(password);
    }

    public static void main(String[] args) {
        String password = "StrongPassword123!";
        System.out.println(StrongPassword.isStrong(password));
    }
}
