Created
May 1, 2019 05:12
-
-
Save hellosagar/96891bfcb556276aa41b1228f88b518c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.PasswordAuthentication; | |
public class password { | |
public static void main(String[] args) { | |
String pass="Sagar@123aaa"; | |
boolean flag0=false; | |
boolean flag1=false; | |
boolean flag2=false; | |
boolean flag3=false; | |
int a=pass.length(); | |
for (int i=0;i<pass.length();i++){ | |
int b=pass.charAt(i); | |
if (b>=65&&b<=97){ | |
flag0=true; | |
} | |
else if (b>=97&&b<=122){ | |
flag1 = true; | |
} | |
else if (b>=33&&b<=47||b>=91&&b<=96||b>=58&&b<=64||b>=123&&b<=126){ | |
flag2= true; | |
} | |
else if (b>=48&&b<=57){ | |
flag3=true; | |
} else{ | |
System.out.println("PASSWORD INVALID"); | |
} | |
} | |
if (flag0==true&&flag1==true&&flag2==true&&flag3==true&&a>=8&&a<=12){ | |
System.out.println("VALID PASSWORD!"); | |
}else{ | |
System.out.println("INVALID PASSWORD!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment