title: Looping through two arrays to check if equal
body: <p>Trying to check if two arrays are equal, meaning same length and same elements in positions.</p>
  
  <p>I've tried Arrays.equals(1,2) but it's still coming out as false, while it needs to be coming out as true.</p>
  
  <p>I've tried to create a nested for loop to check each index but I am still getting false.</p>
  
  <p>My code:</p>
  
  <pre><code>public boolean equals(double[] s) //for loop checking each element
  {
      if (s==null)
      {
          return false;
      }
      for (int i=0;i&lt;data.length;i++)
      {
          for(int j=0;j&lt;s.length;j++)
          {
              if (data[i]!=s[j])
              {
                  return false;
              }
          }
      }
      return true;
  
  }
  </code></pre>