<awangdev>Search Insert Position_1.java
public int searchInsert(int[] A, int target) {
        if (A == null || A.length == 0) {
            return 0;
        }
        int start = 0;
        int end = A.length - 1;
        int mid = start + (end - start)/2;

        while (start + 1 < end) {
            mid = start + (end - start)/2;
            if (A[mid] == target) {
                return mid;
            } else if (A[mid] > target) {
                end = mid;
            } else {
                start = mid;
            }
        }
        
        if (A[start] >= target) {
            return start;
        } else if (A[start] < target && target <= A[end]) {
            return end;
        } else {
            return end + 1;
        }
    }
public int sample_funcname ( int [ ] var_0 , int var_1 ) {
  if ( var_0 == null || var_0 . length == 0 ) {
    return 0 ;
  }
  int var_5 = 0 ;
  int var_7 = var_0 . length - 1 ;
  int var_9 = var_5 + ( var_7 - var_5 ) / 2 ;
  while ( var_5 + 1 < var_7 ) {
    var_9 = var_5 + ( var_7 - var_5 ) / 2 ;
    if ( var_0 [ var_9 ] == var_1 ) {
      return var_9 ;
    }
    else if ( var_0 [ var_9 ] > var_1 ) {
      var_7 = var_9 ;
    }
    else {
      var_5 = var_9 ;
    }
  }
  if ( var_0 [ var_5 ] >= var_1 ) {
    return var_5 ;
  }
  else if ( var_0 [ var_5 ] < var_1 && var_1 <= var_0 [ var_7 ] ) {
    return var_7 ;
  }
  else {
    return var_7 + 1 ;
  }
}
