title: Method for equal arrays
body: <p>beginner here!</p>
  
  <p>I am trying to write a boolean method that returns <code>true</code> if the two arrays a and b have exactly the same elements in the same order, and <code>false </code>otherwise.</p>
  
  <p>Although, I am having a problem with comparing two null arrays, for which i want it to return true if:</p>
  
  <pre><code>int [] A = { };
  
  int [] B = { };
  </code></pre>
  
  <p>My code so far is:</p>
  
  <pre><code>public static boolean equalArrays(int [] a, int [] b) {
      if(a.length == 0 &amp;&amp; b.length == 0)
          return true;
      else {
          if(a.length == b.length)
              for(int i = 0; i &lt; a.length ; i++)
                  if (a[i] == b[i])
                      return true;
      }
     return false;
  }
  </code></pre>
  
  <p>EDIT1: Fixed the code above</p>
  
  <p>EDIT2: Another problem is when i try testing</p>
  
  <pre><code>int [] A = {2, 3, 4, 5, 6};
  int [] B = {2, 3, 4, 6, 5};
  </code></pre>
  
  <p>It returns true when it is supposed to return false. Anyone have any idea on where the problem is?</p>