title: Sum of 2 different 2D arrays
body: <p>I need help writing a method to find out a sum of 2 different sized 2D arrays.</p>
  <pre class="lang-java prettyprint-override"><code>public static int[][] summary(int[][] tab1, int[][] tab2, int x) {
      int[][] finalTab = new int[4][5]; // I took sizes of bigger one
      if (x &lt; 0) {
          for (int i = 0; i &lt; finalTab.length - 1; i++) {
              for (int j = 0; j &lt; finalTab[i].length - 1; j++) {
                  finalTab[i][j] = tab1[i][j] + tab2[i][j];
                  if (tab1[i][j] == 0) {
                      finalTab[i][j] = tab2[i][j];
                  }
              }
          }
          for (int i = 0; i &lt; finalTab.length; i++) {
              for (int j = 0; j &lt; finalTab[i].length; j++) {
                  System.out.print(&quot; &quot; + finalTab[i][j] + &quot; &quot;);
              }
              System.out.println();
          }
      }
      return finalTab;
  }
  </code></pre>
  <p>Input is:</p>
  <pre class="lang-java prettyprint-override"><code>int[][] tab1 = {
          {2, 4, 6, 8},
          {2, 4, 6, 8},
          {2, 4, 6, 8}};
  
  int[][] tab2 = {
          {1, 3, 5, 7, 9},
          {1, 3, 5, 7, 9},
          {1, 3, 5, 7, 9},
          {1, 3, 5, 7, 9}};
  </code></pre>
  <p>Output is:</p>
  <pre><code> 3  7  11  15  0 
   3  7  11  15  0 
   3  7  11  15  0 
   0  0  0  0  0 
  </code></pre>
  <p>Output should be:</p>
  <pre><code> 3  7  11  15  9
   3  7  11  15  9
   3  7  11  15  9
   1  3  5  7  9
  </code></pre>
  <p>How can I replace all of <code>0</code> with numbers corresponding to the index of <code>tab2</code>?</p>