title: Java For loops and char arrays
body: <p>I am making a "Code Decoder" - So there are 3 lines, the first is the reference string, the second is jumbled, and then the third is calculated based on matching the first and second strings. Example: </p>
  
  <ol>
  <li><p>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG</p></li>
  <li><p>UIFARVJDLACSPXOAGPYAKVNQTAPWFSAUIFAMB ZAEPH</p></li>
  <li><p>XFABSFAWFSZACBEAQFPQMFAEPJOHAWFSZACBEAUIJOHTAIBAIB</p></li>
  </ol>
  
  <p>What I'm doing is getting the 3 strings, converting them to char arrays, then looking through the first string, finding where it is in the array of the alphabet, then at that position I enter the letter from the second string on another array at the same place. Therefore, later, I can find a letter in the alphabet and get its corresponding letter in the second array. </p>
  
  <p>Problem - nothing is inputting into the second array... It comes up empty. </p>
  
  <p>Let me know if any clarification is needed. </p>
  
  <pre><code>    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Enter First String:"); // First String
      String first_string = br.readLine();
      System.out.print("Enter Second String:"); // Second String 
      String second_string = br.readLine();
      System.out.print("Enter Third String:"); // Third String 
      String third_string = br.readLine();
  
      char[] first = first_string.toCharArray();
      char[] second = second_string.toCharArray();
      char[] third = third_string.toCharArray();
      char[] compare_a = {'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'}; //length = 26
      char[] compare_b = new char[26]; //length = 26
  
      for(int x =0; x &lt; first.length ; x++){// going through first array
          char first_letter = first[x]; // gets letter from first string
  
          for(int z = 0; z &lt; 26; z++){ // looks through alphabet for the position of the letter
              if(first_letter == compare_a[z]){ // if the letter is found at a certain position
                  // System.out.println(first_letter + " = " + compare_a[z] + " " + compare_b[z]  + " " +  second[x]);
                  compare_b[z] = second[x]; // insert into the same position on the second array
              }
          }
      }
  
      for(int t =0; t&lt;26; t++){
  
          char m = compare_b[t];
          System.out.print(m); //Printing out array of new letters
      }
  }
  </code></pre>
  
  <p>Note: </p>
  
  <p>When I tried outputting the results to a string, it comes out correctly ---</p>
  
  <pre><code>   letters = letters + second[x];
  </code></pre>
  
  <p>It just doesn't go into the array... </p>