我需要我的代码来检查密码,密码中的一个字母应该是大写的。当用户进入时。请协助。
int digcheck=0,charcheck=0,symbcheck=0;
for (int i = 0; i < passwordraw.length(); i++) {
if (Character.isDigit(passwordraw.charAt(i)))
{
digcheck++;
}
else if(Character.isLetter(passwordraw.charAt(i)))
{
charcheck++;
}
else
{
symbcheck++;
}
}
if(digcheck<3)
{
digcheck=0;
throw new OBSSecurityException("INVALID PASSWORD! Must have atleast three(3) digits.");
}else if(charcheck<5)
{
charcheck=0;
throw new OBSSecurityException("INVALID PASSWORD! Must have atleast five(5) alpha.");
}
else if(symbcheck<1)
{
symbcheck=0;
throw new OBSSecurityException("INVALID PASSWORD! Must have atleast one(1) symbol.");
}