Guest User

Untitled

a guest
Jul 3rd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. public class SecondLifeAccount2 {
  2.  
  3. private String username;
  4. private String password;
  5. private int month;
  6. private int day;
  7. private int year;
  8. private String secretQuestion;
  9. private String secretAnswer;
  10. static int pos = 0;
  11. static int countU = 0;
  12. static int countL = 0;
  13. static int countD = 0;
  14. static int minChars = 6;
  15. static int maxChars = 16;
  16.  
  17. public SecondLifeAccount2() {
  18. }
  19.  
  20. public SecondLifeAccount2(String u, String pass, int m, int d, int y,
  21. String q, String a) {
  22. username = u;
  23. password = pass;
  24. month = m;
  25. day = d;
  26. year = y;
  27. secretQuestion = q;
  28. secretAnswer = a;
  29.  
  30. }
  31.  
  32. public static boolean goodPassword(String password) {
  33.  
  34. if (password.length() >= minChars && password.length() <= maxChars) {
  35.  
  36. while (pos < password.length()) {
  37.  
  38. char letter = password.charAt(pos);
  39.  
  40. pos++;
  41.  
  42. if (Character.isUpperCase(letter)) {
  43. countU++;
  44. }
  45. if (Character.isLowerCase(letter)) {
  46. countL++;
  47. }
  48. if (Character.isDigit(letter)) {
  49. countD++;
  50. }
  51. if (password.length() >= minChars && password.length()
  52. <= maxChars && countU > 0 && countL > 0 && countD > 0) {
  53. return true;
  54. } else {
  55. return false;
  56. }
  57. }
  58.  
  59.  
  60.  
  61. }
  62.  
  63.  
  64. }
  65. }
Add Comment
Please, Sign In to add comment