Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- length = keyboard.nextInt();
- keyboard.nextLine();
- System.out.println("Please type in yes or no for the following questions.");
- System.out.println("Would you like to include capital letters in your password? ");
- response=keyboard.nextLine().toLowerCase();
- if(response.equalsIgnoreCase("yes"))
- {list[0]=1;}
- if(response.equalsIgnoreCase("no"))
- {list[0]=0;}
- System.out.println("Would you like to include lowercase letters in your password? ");
- response=keyboard.nextLine().toLowerCase();
- if(response.equalsIgnoreCase("yes"))
- {list[1]=1;}
- if(response.equalsIgnoreCase("no"))
- {list[1]=0;}
- System.out.println("Would you like to include numbers in your password? ");
- response=keyboard.nextLine().toLowerCase();
- if(response.equalsIgnoreCase("yes"))
- {list[2]=1;}
- if(response.equalsIgnoreCase("no"))
- {list[2]=0;}
- System.out.println("Would you like to include symbols letters in your password? ");
- response=keyboard.nextLine().toLowerCase();
- if(response.equalsIgnoreCase("yes"))
- {list[3]=1;}
- if(response.equalsIgnoreCase("no"))
- {list[3]=0;}
- System.out.println(Arrays.toString(list));
- System.out.println(length+"length of password");
- }////
- SecureRandom character = new SecureRandom();
- String Capital="QWERTYUIOPASDFGHJKLZXCVBNM";
- String LowerCase="qwertyuiopasdfghjklzxcvbnm";
- String Numbers="1234567890";
- String Special="!@#$%&*?";
- String alphabet="";
- String Password;
- if(list[0]==1)
- alphabet= alphabet.concat(Capital);
- if(list[1]==1)
- alphabet=alphabet.concat(LowerCase);
- if(list[2]==1)
- alphabet=alphabet.concat(Numbers);
- if(list[3]==1)
- alphabet=alphabet.concat(Special);
- for(int i=0; i<length;i++)
- System.out.println(alphabet.charAt(character.nextInt(alphabet.length())));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement