title: Sum of all elements in Rectangular 2D array
body: <p>I am supposed to make a program to add all the elements inside the 2D rectangular array but the answer for this is supposed to be 31, instead it prints 33.
  What am I doing wrong?</p>
  
  <p>Heres the code:</p>
  
  <pre><code>public static int sum(int[][] array) {
          int[][] numArray = {
  
                                  {3, -1,  4,  0},
                                  {5,  9, -2,  6},
                                  {5,  3,  7, -8}
  
                             };
          int sumOfRow = 0;
          for (int i = 0; i &lt; numArray.length; i++) {
              sumOfRow += numArray[0][i];
              sumOfRow += numArray[1][i];
              sumOfRow += numArray[2][i];
          }
  
          System.out.println(sumOfRow);
          return sumOfRow;
  }
  </code></pre>