title: Populate a 2d array from a string and put the ASCII value of the individual characters into it
body: <p>I am creating a program that will read a txt file(from another master txt file), take the string which is a bunch of letters(@-K), and then populate a 2d array with the ASCII value of the characters in the string. So I have successfully created the 2d array and read the file. The problem is that my array is only being populated by the first letter of the string file, and not going through the entire file. I have an if statement that I believe should read through the file and populate it properly, however it is not doing it. Can't figure out what im doing wrong. Here is the code.</p>
  
  <pre><code>     public static void main(String[] args) throws IOException 
    {
      String txtfile;
      String txtfilecontents;
      int matrix[][]= new int [24][34];
      int row=0;
      int col=0;
      BufferedReader masterfile = new BufferedReader(new FileReader("imageFileList.txt")); 
      while((txtfile=masterfile.readLine())!=null)                                              //reads master text file
      {
        BufferedReader imagefile= new BufferedReader(new FileReader(txtfile));
        while((txtfilecontents=imagefile.readLine())!=null)                                     //reads text file within master file
        {
          for(int i=0;i&lt;txtfilecontents.length();i++)                                           
          {
            if(col ==34)
            {
              col = 0;
              row++;
            }
            if(row ==24)
            {
              col=0;
              row=0;
              break;
            }
            matrix[row][col] = (int)txtfilecontents.charAt(i)-64;                                  //instead of adding every character it only adds the first one until it fills up the 2d array
            col++;
          }
          System.out.println(txtfilecontents);
          for(row=0;row&lt;24;row++)
          {
            for(col=0;col&lt;34;col++)
              System.out.printf("%4d",matrix[row][col]);
            System.out.println();
          }
        }
  
        System.out.println(txtfile);
      }
  
  
    }   
  </code></pre>
  
  <p>Here is an example of what a txtfile has in it.</p>
  
  <pre><code>AKHIICG@KDHDJKGHHHFGECEGHEIEHDCBF@DB@DDIABHI@GHAFAFHEGCECEJ@GHKJCBGFFFH@IB@JB@KKBFAGABCJHJ@AEDIABGI@DDCJHCAK@@FBKHGB@KFI@KKEJCJFHBDAJBAJKCGEE@DFDBBD@GDEIJAIKBHCDH@AAJK@EJHEGGKGJEJ@@F@@AGDFECCFIFHDEGHBJCABEKBFIIEBJGFHKJJFKFKDEKHBBEIBAHBGKDHKFKCAEJFDHEHK@@AIIBF@EEBB@BEGEBIKDJGKEJKHKHAJJDGFKFGIKI@ECH@FBEEGKDACKGHAIBCJGDJCEKD@K@AGGHGACHCE@HCEDI@FDJDGIJAJFCEFHEBDBGIIGJAFEGGFHJBIHBICB@EDDFEDFBKACJ@JCKKAKEJACICEBIJEFIICH@J@CCE@EJI@BKEFAGAJKKEDHICC@@@DJEGIHFDHDCJGJECHGCBIHC@K@FEHECEKKJAABFAAFA@EHFBFAEHBFCEFDBDKCB@BFGBBKG@@GKBKJEHI@H@DH@IJ@FFICEDBDJECA@@DKHAIFJII@DDEBI@IGIFJ@@BFC@IHGCJEAG@CAF@CCFEC@AFKDDKKAD@K@HDBDAIDIKCGJJGEECGIIECDGDHHBC@FJDGJJDB@AKBBGEEIFK@D@BCCG@IAEJEECDCFBBE@AK@EAEDGCEKIBDKHICG@DFDDGJGHGDE@CGIEAEEHBKFCBICDGADBHDEABJGHCEIDDJD@BEEJA@JFB@IFGDA@GAGDAEDBDCFGKEJEDDKFCE@FHJIB@JDAEECHBJCDAEFAHBDJC@FH
  </code></pre>
  
  <p>Also I have added a bunch of print statements in the file so I could see what my output was coming up with, but it will be taken out later.</p>