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"); } } 第二题
点赞 3

相关推荐

点赞 评论 收藏
分享
哥_留个offer先:跟他说,你这个最好用c#,微软就用c#Java不适合这个项目
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务