title: Finding the difference between two int arrays
body: <p>I am having trouble figuring out the algorithm that will find the differences between two integer arrays. <strong>I already have a sorting method that it will be ran through so the numbers are in ascending order.</strong></p>
  
  <p>For example:</p>
  
  <p><strong>SetX = { 1, 2, 3, 4, 5 }</strong></p>
  
  <p><strong>SetY = { 0, 2, 4, 6 }</strong></p>
  
  <p>The return should be the numbers in SetX that does not appear in SetY. </p>
  
  <p>so <strong>resultSet = { 1, 3, 5 }</strong></p>
  
  <p>Sometimes I get the correct answer if I do small arrays but if I do arrays that are 4 or more Integers long it gives me the wrong return.</p>
  
  <p>Can someone look over my code and tell me what I am doing wrong?</p>
  
  <pre><code>public static int firstFruit(int[] setX, int usedSizeSetX, int[] setY, int usedSizeSet2, int[] resultSet) {
      int a = 0, b = 0, c = 0;
  
      while( a &lt; usedSizeSetX &amp;&amp; b &lt; usedSizeSetY){
          if(setX[a] == setY[b]) {
              a++;
          } else if(setX[a] == setY[b]){
              b++;
          } else {
              resultSet[c++] = setX[a++];
              b++;
          }
      }
      return c;
  }
  </code></pre>