public static void getRes(String arr, ArrayList<String> res) { if (arr.length() < 8) { res.add("Irregular password"); } else { boolean hasUpChar = false; boolean hasLowChar = false; boolean hasFuhao = false; boolean hasNum = false; for (int j = 0; j < arr.length(); j++) { char c = arr.charAt(j); if (Character.isDigit(c)) hasNum = true; else if (Character.isUpperCase(c)) hasUpChar = true; else if (Character.isLowerCase(c)) hasLowChar = true; else hasFuhao = true; } if (hasFuhao && hasNum && hasLowChar && hasUpChar) res.add("Ok"); else res.add("Irregular password"); } } 第二题
![](https://uploadfiles.nowcoder.com/images/20191018/63_1571399780081_079F4FB55B755F6F198BEE97D7C95390)