public class Rotator {
void reverse(int a[], int n) {
for (int i = 0; i <= n - 1; i++) {
int temp;
temp = a[i];
a[i] = a[n - 1];
a[n - 1] = temp;
n--;
}
printArray(a);
}
void printArray(int a[]) {
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}
public static void main(String[] args) throws IOException {
// TODO code application logic here
System.out.println("Enter the password");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String Password = br.readLine();
if (Password.length() >= 5 & Password.length() <= 12) {
for (int i = 0; i < Password.length(); i++) {
if (Character.isLetter(Password.charAt(i))) {
if (Character.isLowerCase(Password.charAt(i))) {
if (Character.isDigit(Password.charAt(i))) {
if (!(Password.charAt(i) == Password.charAt(i + 1))) {
if (!Character.isUpperCase(Password.charAt(i)) && !Character.isSpaceChar(Password.charAt(i))) {
System.out.println("Your password is valid");
}
else {
System.out.println("contains upper case or special character");
}
}
else {
System.out.println("contains patterns");
}
}
else {
System.out.println("Does not contains digit");
}
}
else {
System.out.println("Does not contains Lower Case Char");
}
}
}
}
else {
System.out.println("Invalid assword length ... plz try again with another password of length between 5-12");
}
}
}
void reverse(int a[], int n) {
for (int i = 0; i <= n - 1; i++) {
int temp;
temp = a[i];
a[i] = a[n - 1];
a[n - 1] = temp;
n--;
}
printArray(a);
}
void printArray(int a[]) {
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}
public static void main(String[] args) throws IOException {
// TODO code application logic here
System.out.println("Enter the password");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String Password = br.readLine();
if (Password.length() >= 5 & Password.length() <= 12) {
for (int i = 0; i < Password.length(); i++) {
if (Character.isLetter(Password.charAt(i))) {
if (Character.isLowerCase(Password.charAt(i))) {
if (Character.isDigit(Password.charAt(i))) {
if (!(Password.charAt(i) == Password.charAt(i + 1))) {
if (!Character.isUpperCase(Password.charAt(i)) && !Character.isSpaceChar(Password.charAt(i))) {
System.out.println("Your password is valid");
}
else {
System.out.println("contains upper case or special character");
}
}
else {
System.out.println("contains patterns");
}
}
else {
System.out.println("Does not contains digit");
}
}
else {
System.out.println("Does not contains Lower Case Char");
}
}
}
}
else {
System.out.println("Invalid assword length ... plz try again with another password of length between 5-12");
}
}
}
No comments:
Post a Comment