public static int[] minus(int y1[],int y2[]){
  int keep[]=new int[Math.max(y1.length,y2.length)];
  int i=0, j=0, k=0;
  while (j < y1.length && k < y2.length) {
    if (y1[j] == y2[k]) {
      j++;
      k++;
    }
 else     if (y1[j] < y2[k]) {
      keep[i++]=y1[j];
      j++;
    }
 else {
      k++;
    }
  }
  while (j < y1.length) {
    keep[i++]=y1[j++];
  }
  return Arrays.copyOf(keep,i);
}

public static int [ ] minus ( int y1 [ ] , int y2 [ ] ) { int keep [ ] = new int [ Math . max ( y1 . length , y2 . length ) ] ; int i = 0 , j = 0 , k = 0 ; while ( j < y1 . length && k < y2 . length ) { if ( y1 [ j ] == y2 [ k ] ) { j ++ ; k ++ ; } else if ( y1 [ j ] < y2 [ k ] ) { keep [ i ++ ] = y1 [ j ] ; j ++ ; } else { k ++ ; } } while ( j < y1 . length ) { keep [ i ++ ] = y1 [ j ++ ] ; } return Arrays . copyOf ( keep , i ) ; }
minus aka set difference , e . g . , [ 3 , 4 , 7 , 9 ] \ [ 3 , 7 ] = [ 4 , 9 ] .
