http://howsecureismypassword.net/
public static int parsePassword(String password) {
int result = 0;
Pattern ps = Pattern
.compile("[a-zA-Z0-9_\\,\\.\\-\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\+]{6,16}");
Pattern lower = Pattern.compile("[a-z]");
Matcher mlower = lower.matcher(password);
Pattern upper = Pattern.compile("[A-Z]");
Matcher mupper = upper.matcher(password);
Pattern special = Pattern
.compile("[_\\,\\.\\-\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\+]");
Matcher mspecial = special.matcher(password);
if (ps.matcher(password).matches()) {
if (mspecial.find()) {
result = 3;
} else if (mupper.find()) {
result = 2;
} else if (mlower.find()) {
result = 1;
}
}
return result;
}