title: How do I remove duplicates from two arrays?
body: <p>I need to have an algorithm that changes values in one array if it is in the second array.  The result is that the first array should not have any values that are in the second array.</p>
  
  <p>The arrays are of random length (on average ranging from 0 to 15 integers each), and the content of each array is a list of sorted numbers, ranging from 0 to 90.</p>
  
  <pre><code>public void clearDuplicates(int[] A, int[] B){
      for(int i = 0; i &lt; A.length; i++){
          for(int j = 0; j &lt; B.length; j++)
              if(A[i] == B[j])
                  A[i]++;
      }
  }
  </code></pre>
  
  <p>My current code does not clear all of the duplicates. On top of that it might be possible it will creat an index out of bounds, or the content can get above 90.</p>