title: getting StringIndexOutOfBound Exception
body: <p>I am writing a program to accept user name and password using following conditions- username must be min 8 characters. Password must have min 10 characters, 1 lowerCase, 1 upperCase, 1 digit should present in the password.
  I wrote a method setPassword() following all the conditions. When I try to execute I am getting StringIndexOutOfBound exception. I am unable to understand why I am getting that error:</p>
  
  <pre><code>public void setPassword(String password)
  {
      char ch;
      if (password.length() &lt;= 10) {
          for (int i = 0; i &lt;= password.length() - 1; i++) {
              ch = password.charAt(i);
              if (Character.isDigit(ch)) {
                  for (int j = 0; j &lt;= password.length() - 1; j++) {
                      char ch1 = password.charAt(j);
                      if (Character.isUpperCase(ch1)) {
                          for(int k = 0; k &lt;= password.length(); k++) {
                              char ch2 = password.charAt(k);
                              if (Character.isLowerCase(ch2)) {
                                  this.password = password;
                              }
                          }
                      }
                  }
              }
          }
      }
  }
  </code></pre>