|
|
@@ -1,2 +1,30 @@ |
|
|
|
public class PasswordChecker { |
|
|
|
|
|
|
|
private final static int pwMinLength = 6; |
|
|
|
|
|
|
|
public static boolean pwLength(String password){ |
|
|
|
return password.length() >= pwMinLength; |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean pwContainsNum(String password){ |
|
|
|
for (int i = 0; i < password.length(); i++) { |
|
|
|
if(Character.isDigit(password.charAt(i))){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private static boolean pwContainsSpecialHelper(char c){ |
|
|
|
return(!(Character.isDigit(c)|| Character.isLetter(c))); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean pwContainsSpecial(String password){ |
|
|
|
for (int i = 0; i < password.length(); i++) { |
|
|
|
if(pwContainsSpecialHelper(password.charAt(i))){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |