<awangdev>Search for a Range_1.java
public int[] searchRange(int[] A, int target) {
        int[] rst = new int[]{-1, -1};
        if (A == null || A.length == 0) {
            return rst;
        }
        int start = 0;
        int end = A.length - 1;
        int mid = start + (end - start)/2;

        int first = 0;
        while (start + 1 < end) {
            mid = start + (end - start)/2;
            if (A[mid] == target) {
                if (mid - 1 >= 0 && A[mid - 1] == target) {
                    end = mid;
                    continue;
                }
                break;
            } else if (A[mid] < target) {
                start = mid;
            } else {
                end = mid;
            }
        }
        if (A[start] == target) {
            first = start;
        } else if (A[mid] == target) {
            first = mid;
        } else if (A[end] == target) {
            first = end;
        } else {
            return rst;
        }

        int last = first;
        start = first;
        end = A.length - 1;
        while (start + 1 < end) {
            mid = start + (end - start)/2;
            if (A[mid] == target) {
                if (mid + 1 < A.length && A[mid + 1] == target) {
                    start = mid;
                    continue;
                }
                break;
            } else if (A[mid] < target) {
                start = mid;
            } else {
                end = mid;
            }
        }
        if (A[end] == target) {
            last = end;
        } else if (A[mid] == target) {
            last = mid;
        } else if (A[start] == target) {
            last = start;
        }
        
        rst[0] = first;
        rst[1] = last;
        
        return rst;
    }
public int [ ] sample_funcname ( int [ ] var_0 , int var_1 ) {
  int [ ] var_3 = new int [ ] {
    - 1 , - 1 };
    if ( var_0 == null || var_0 . length == 0 ) {
      return var_3 ;
    }
    int var_7 = 0 ;
    int var_8 = var_0 . length - 1 ;
    int var_10 = var_7 + ( var_8 - var_7 ) / 2 ;
    int var_11 = 0 ;
    while ( var_7 + 1 < var_8 ) {
      var_10 = var_7 + ( var_8 - var_7 ) / 2 ;
      if ( var_0 [ var_10 ] == var_1 ) {
        if ( var_10 - 1 >= 0 && var_0 [ var_10 - 1 ] == var_1 ) {
          var_8 = var_10 ;
          continue ;
        }
        break ;
      }
      else if ( var_0 [ var_10 ] < var_1 ) {
        var_7 = var_10 ;
      }
      else {
        var_8 = var_10 ;
      }
    }
    if ( var_0 [ var_7 ] == var_1 ) {
      var_11 = var_7 ;
    }
    else if ( var_0 [ var_10 ] == var_1 ) {
      var_11 = var_10 ;
    }
    else if ( var_0 [ var_8 ] == var_1 ) {
      var_11 = var_8 ;
    }
    else {
      return var_3 ;
    }
    int var_12 = var_11 ;
    var_7 = var_11 ;
    var_8 = var_0 . length - 1 ;
    while ( var_7 + 1 < var_8 ) {
      var_10 = var_7 + ( var_8 - var_7 ) / 2 ;
      if ( var_0 [ var_10 ] == var_1 ) {
        if ( var_10 + 1 < var_0 . length && var_0 [ var_10 + 1 ] == var_1 ) {
          var_7 = var_10 ;
          continue ;
        }
        break ;
      }
      else if ( var_0 [ var_10 ] < var_1 ) {
        var_7 = var_10 ;
      }
      else {
        var_8 = var_10 ;
      }
    }
    if ( var_0 [ var_8 ] == var_1 ) {
      var_12 = var_8 ;
    }
    else if ( var_0 [ var_10 ] == var_1 ) {
      var_12 = var_10 ;
    }
    else if ( var_0 [ var_7 ] == var_1 ) {
      var_12 = var_7 ;
    }
    var_3 [ 0 ] = var_11 ;
    var_3 [ 1 ] = var_12 ;
    return var_3 ;
  }
  