title: sum up values and store it into array
body: <p>I have the following results after multiplying the 2d array with the array.</p>
  
  <pre><code>76,0,38,7,32,0,16,18,32,0,16,18,0,0,0,19,16,0,8,23,76,0,38,25
  </code></pre>
  
  <p>now I want to add the value 2 by 2 and store it in another array(results[])
  so it goes like</p>
  
  <pre><code>76 + 0 = 76(results[0])     
  38 + 7 = 45(results[1)
  32 + 0 = 32(results[2])
  16 + 18 = 34(results[3])  
  32 + 0 = 32(results[4])
  16 + 18 = 34(results[5]) 
  0 + 0 = 0(results[6])
  0 + 19 = 19(results[7])
  16 + 0 = 16(results[8])
  8 + 23 = 31(results[9])
  76 + 0 = 76(results[10])
  38 + 25 = 63(results[11])
  </code></pre>
  
  <p>but i got this result instead which is wrong</p>
  
  <pre><code>114 
  7
  48
  18
  48
  18
  0
  19
  24
  23
  114
  25
  </code></pre>
  
  <p>Please help.</p>
  
  <pre><code>public static void main(String argv[]) {
      int matrix[][]= { {4,0},
                              {2,1},
  
      };
  
      int array[] = {19,7,8,18,8,18,0,19,4,23,19,25};
  
      int result[] = new int[12]; 
      for (int count = 0; count &lt; array.length; count+= matrix.length) {  
          for (int r = 0; r &lt; matrix.length; r++) {
              for (int c = 0; c &lt; matrix.length; c++) {
                  result[count] += matrix[r][c] * array[count++];                 
              }
              count -= matrix.length;
          }
      }
  
      for(int i = 0; i &lt; result.length; i++) {
          System.out.println(result[i]);
      }
  }
  </code></pre>