PasswordCheckerUtility.java - import java.util.ArrayList...

This preview shows page 1 - 2 out of 3 pages.

import java.util.ArrayList;import java.util.regex.Matcher;import java.util.regex.Pattern;public class PasswordCheckerUtility {public static boolean isValidPassword(String passwordString) throws LengthException, NoDigitException, NoSpecialCharacterException, NoUpperAlphaException,NoLowerAlphaException,InvalidSequenceException {char ch = passwordString.charAt(0);//check lengthif(passwordString.length()<6) {if (passwordString.length()<6) {throw new LengthException();}return false;}//check numberif (true) { int count = 0; for (int i = 0; i <= 9; i++) { String str1 = Integer.toString(i); if (passwordString.contains(str1)) { count = 1; } } if (count == 0) {if(count == 0) {throw new NoDigitException();}return false; }}//check upper case alphabetic characterif(true) {int count=0;for (int i=0; i<passwordString.length(); ++i) {if (Character.isUpperCase(passwordString.charAt(i))) {count =1;}}if (count==0) {if(count == 0) {throw new NoUpperAlphaException();} return false;}}//check lower case alphabetic characterif(true) {int count=0;for (int i=0; i<passwordString.length(); ++i) {
Background image
Image of page 2

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture