title: User keyword substitution cipher looping over two different sized arrays
body: <p>Been programming for 4 weeks go easy on me...</p>
  
  <p><strong>Aim:</strong> I need to take a user input "keyword" and use this keyword in an alphabet cipher.</p>
  
  <p><strong>Example:</strong> User provides keyword "SALT."</p>
  
  <p><strong>Cipher:</strong> SALTBCDEFGHIJKMNOPQRUVWXYZ. (keyword + remaining alphabet letters)</p>
  
  <p>I have made my string keyword into a char array and I have an alphabet array. I wanted the code to loop over both arrays and if the alphabet letter was not present (equal to) the keyword letters then it would add it on to the end of the keyword. </p>
  
  <p>Issues - I am getting an ArrayOutOfBoundsException - which I believe it due to both my arrays being different sizes? Not sure how to fix that. Also would I need to create a third array to hold the keyword + remaining alphabet letters as arrays cant change size? I can only use Arrays nothing else (Lists, Hashsets etcs as I've not learned them yet). Thanks for any help..</p>
  
  <pre><code>    char[] arr = keyWord.toCharArray();
      for (char c:arr) {
          System.out.println(c); //printing to see if it worked   
      }
  
      char [] alphabet = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
              'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
              'V', 'W', 'X', 'Y', 'Z'
              };
  
      System.out.println(alphabet);
  
      boolean flag = false;
      for (int i = 0; i &lt;alphabet.length; i++) {
          for (int j = 0; j &lt;keyWord.length(); j++) {
  
              if (alphabet[j] != arr[i]) 
              //if alpha letter is not equal to keyword letters
              flag = false;
              break;
              }
              if (flag)
              //(false) just trying to print anything so
              // i can see whats happening..
                  System.out.println(alphabet[i]);
  
      }
  }
  </code></pre>
  
  <p>}</p>