File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ public class PasswordStrength {
2+ public static void main (final String ar []) {
3+ String password = AbraKadabra1287832FQENi ;
4+
5+ boolean hasLetter = false ;
6+ boolean hasDigit = false ;
7+ boolean hasUpperCase = false ;
8+ boolean hasLowerCase = false ;
9+
10+ if (password .length () >= 8 ) {
11+ for (int i = 0 ; i < password .length (); i ++) {
12+ char x = password .charAt (i );
13+ if (Character .isLetter (x )) {
14+ if (Character .isUpperCase (x )) {
15+ hasUpperCase = true ;
16+ } else if (Character .isLowerCase (x )) {
17+ hasLowerCase = true ;
18+ }
19+ hasLetter = true ;
20+ } else if (Character .isDigit (x )) {
21+ hasDigit = true ;
22+ }
23+ if (hasLetter && hasDigit && hasUpperCase && hasLowerCase ) {
24+ break ;
25+ }
26+ }
27+ if (hasLetter && hasDigit && hasUpperCase && hasLowerCase ) {
28+ System .out .println ("STRONG" );
29+ } else {
30+ System .out .println ("NOT STRONG" );
31+ }
32+ } else {
33+ System .out .println ("HAVE AT LEAST 8 CHARACTERS" );
34+ }
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments