comefrom: <awangdev>The Smallest Difference_1.java
code: public int smallestDifference(int[] A, int[] B) {
      	if (A == null || A.length == 0 || B == null || B.length == 0) {
      		return 0;
      	}
      	if (A.length > B.length) {
      		int[] temp = A;
      		A = B;
      		B = temp;
      	}
      	Arrays.sort(A);
      	Arrays.sort(B);
      	int diff = Integer.MAX_VALUE;	
  
      	for (int i = 0; i < A.length; i++) {
      		int start = 0;
      		int end = B.length - 1;
      		int mid;
      		if (B[start] >= A[A.length - 1]) {
              	return B[start] - A[A.length - 1];
              }
              if (A[start] >= B[B.length - 1]) {
              	return A[start] - B[B.length - 1];
              }
      		while (start + 1 < end) {
      			mid = start + (end - start)/2;
      			if (B[mid] == A[i]) {
      				return 0;
      			} else if (mid - 1 >= 0 && B[mid - 1] < A[i] && A[i] < B[mid]) {
      				diff = Math.min(diff, Math.min(A[i] - B[mid - 1], B[mid] - A[i]));
      				break;
      			} else if (mid + 1 < B.length - 1 && B[mid] < A[i] && A[i] < B[mid + 1]) {
      				diff = Math.min(diff, Math.min(A[i] - B[mid], B[mid + 1] - A[i]));
      				break;
      			} else if (B[mid] > A[i]) {
      				end = mid;
      			} else {
      				start = mid;
      			}
      		
      		}
          	if (start + 1 >= end) {
          	    int min = Math.min(Math.abs(A[i] - B[start]), Math.abs(A[i] - B[end]));
  				diff = Math.min(diff, min);
  			}
      	}
      	return diff;
      }
masked: public int sample_funcname ( int [ ] var_0 , int [ ] var_1 ) {
    if ( var_0 == null || var_0 . length == 0 || var_1 == null || var_1 . length == 0 ) {
      return 0 ;
    }
    if ( var_0 . length > var_1 . length ) {
      int [ ] var_5 = var_0 ;
      var_0 = var_1 ;
      var_1 = var_5 ;
    }
    Arrays . sort ( var_0 ) ;
    Arrays . sort ( var_1 ) ;
    int var_10 = Integer . MAX_VALUE ;
    for ( int var_11 = 0 ;
    var_11 < var_0 . length ;
    var_11 ++ ) {
      int var_12 = 0 ;
      int var_14 = var_1 . length - 1 ;
      int var_15 ;
      if ( var_1 [ var_12 ] >= var_0 [ var_0 . length - 1 ] ) {
        return var_1 [ var_12 ] - var_0 [ var_0 . length - 1 ] ;
      }
      if ( var_0 [ var_12 ] >= var_1 [ var_1 . length - 1 ] ) {
        return var_0 [ var_12 ] - var_1 [ var_1 . length - 1 ] ;
      }
      while ( var_12 + 1 < var_14 ) {
        var_15 = var_12 + ( var_14 - var_12 ) / 2 ;
        if ( var_1 [ var_15 ] == var_0 [ var_11 ] ) {
          return 0 ;
        }
        else if ( var_15 - 1 >= 0 && var_1 [ var_15 - 1 ] < var_0 [ var_11 ] && var_0 [ var_11 ] < var_1 [ var_15 ] ) {
          var_10 = Math . min ( var_10 , Math . min ( var_0 [ var_11 ] - var_1 [ var_15 - 1 ] , var_1 [ var_15 ] - var_0 [ var_11 ] ) ) ;
          break ;
        }
        else if ( var_15 + 1 < var_1 . length - 1 && var_1 [ var_15 ] < var_0 [ var_11 ] && var_0 [ var_11 ] < var_1 [ var_15 + 1 ] ) {
          var_10 = Math . min ( var_10 , Math . min ( var_0 [ var_11 ] - var_1 [ var_15 ] , var_1 [ var_15 + 1 ] - var_0 [ var_11 ] ) ) ;
          break ;
        }
        else if ( var_1 [ var_15 ] > var_0 [ var_11 ] ) {
          var_14 = var_15 ;
        }
        else {
          var_12 = var_15 ;
        }
      }
      if ( var_12 + 1 >= var_14 ) {
        int min = Math . min ( Math . abs ( var_0 [ var_11 ] - var_1 [ var_12 ] ) , Math . abs ( var_0 [ var_11 ] - var_1 [ var_14 ] ) ) ;
        var_10 = Math . min ( var_10 , min ) ;
      }
    }
    return var_10 ;
  }
  