title: java: comparing value of 2D-array with value of arraylist at the same column
body: <p>I have a 2D-Array with a lot of zeros and some other values. In the first step I am adding up all rows in one column to find out the sum of each column. The result of the sum is saved in an arraylist.
  Now I need to compare each value in the 2D-Array if it is equal to the sum of its column in the arraylist. If it is equal the first value of the row will be saved in a seperate arraylist.</p>
  
  <p>As an example:</p>
  
  <pre><code>          {A, 0, 0, 6, 0}
            {B, 0, 2, 0, 2}
            {C, 0, 1, 0, 0}
            {D, 3, 0, 0, 2}
  
  Arraylist    {3, 3, 6, 4}
  </code></pre>
  
  <p>I want to compare each value with the value in the arraylist at the same position.</p>
  
  <p>My code so far:</p>
  
  <pre><code>List sumList = new ArrayList();
  for(int c = 1; c &lt; excelMatrix.length; c++){
      int sum = 0;
      for(int r = 0; r &lt; excelMatrix.length-1; r++){
          sum = excelMatrix[r][c] + sum;
          sumList.add(sum);
      }
  }
  
  List checkList = new ArrayList();
  for(int c = 1; c &lt; excelMatrix.length; c++){
      for(int r = 0; r &lt; excelMatrix.length-1; r++){
          if(excelMatrix[r][c].equals(sumList)){
              checkList.add(excelMatrix[r][0]);
          }
      }
  }
  </code></pre>
  
  <p>Everything works fine until the comparision of the array value with the value of the arraylist.</p>