brainfrz

Untitled

Mar 1st, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. public static void hasUpperCase(String str) throws PasswordUpperCase
  2. {  
  3.     boolean hasUpperCase = false;
  4.  
  5.     //checks the password for an upper case letter
  6.     for (int c = 0; c < str.length() && Character.isUpperCase(c); c++)
  7.     {
  8.         if(Character.isUpperCase(c))
  9.         {
  10.             hasUpperCase = true;
  11.         }
  12.     }
  13.    
  14.     if (!hasUpperCase)
  15.     {
  16.         throw new PasswordUpperCase();
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment