<awangdev>Search for a Range_2.java
public ArrayList<Integer> searchRange(ArrayList<Integer> A, int target) {
        int start = 0;
        int end = A.size() - 1;
        int mid;
        ArrayList<Integer> bound = new ArrayList<Integer>();
        bound.add(-1);
        bound.add(-1);
        
        if ( A.size() == 0) {
            return bound;
        }
        
        while (start + 1 < end) {
            mid = start + (end - start) / 2;
            if (A.get(mid) < target) {
                start = mid;
            } else if (A.get(mid) > target) {
                end = mid;
            } else {
                end = mid;
            }
        }
        if (A.get(start) == target) {
            bound.set(0, start);
        } else if (A.get(end) == target) {
            bound.set(0, end);
        } else {
            return bound;
        }
        
        start = 0;
        end = A.size() - 1;
        while (start + 1 < end) {
            mid = start + (end - start) / 2;
            if (A.get(mid) < target) {
                start = mid;
            } else if (A.get(mid) > target) {
                end = mid;
            } else {
                start = mid;
            }
        }
        if (A.get(end) == target) {
            bound.set(1, end);
        } else if (A.get(start) == target) {
            bound.set(1, start);
        } else {
            return bound;
        }
        
        return bound;
    }
public ArrayList < Integer > var_1 ( ArrayList < Integer > var_3 , int var_4 ) {
  int var_6 = 0 ;
  int var_9 = var_3 . size ( ) - 1 ;
  int var_10 ;
  ArrayList < Integer > var_11 = new ArrayList < Integer > ( ) ;
  var_11 . add ( - 1 ) ;
  var_11 . add ( - 1 ) ;
  if ( var_3 . size ( ) == 0 ) {
    return var_11 ;
  }
  while ( var_6 + 1 < var_9 ) {
    var_10 = var_6 + ( var_9 - var_6 ) / 2 ;
    if ( var_3 . get ( var_10 ) < var_4 ) {
      var_6 = var_10 ;
    }
    else if ( var_3 . get ( var_10 ) > var_4 ) {
      var_9 = var_10 ;
    }
    else {
      var_9 = var_10 ;
    }
  }
  if ( var_3 . get ( var_6 ) == var_4 ) {
    var_11 . set ( 0 , var_6 ) ;
  }
  else if ( var_3 . get ( var_9 ) == var_4 ) {
    var_11 . set ( 0 , var_9 ) ;
  }
  else {
    return var_11 ;
  }
  var_6 = 0 ;
  var_9 = var_3 . size ( ) - 1 ;
  while ( var_6 + 1 < var_9 ) {
    var_10 = var_6 + ( var_9 - var_6 ) / 2 ;
    if ( var_3 . get ( var_10 ) < var_4 ) {
      var_6 = var_10 ;
    }
    else if ( var_3 . get ( var_10 ) > var_4 ) {
      var_9 = var_10 ;
    }
    else {
      var_6 = var_10 ;
    }
  }
  if ( var_3 . get ( var_9 ) == var_4 ) {
    var_11 . set ( 1 , var_9 ) ;
  }
  else if ( var_3 . get ( var_6 ) == var_4 ) {
    var_11 . set ( 1 , var_6 ) ;
  }
  else {
    return var_11 ;
  }
  return var_11 ;
}
