<gouthampradhan>binary_search_SearchForARange_1.java
private int findIndex(int[] nums, int target, boolean isLowerIndex) {
    int result = -1;
    int s = 0, e = nums.length - 1;
    while (s <= e) {
      int m = s + (e - s) / 2;
      if (nums[m] == target) {
        result = m;
        if (isLowerIndex)
          e = m - 1; 
        else s = m + 1;
      } else if (nums[m] < target) {
        s = m + 1;
      } else e = m - 1;
    }
    return result;
  }
private int sample_funcname ( int [ ] var_0 , int var_1 , boolean var_3 ) {
  int var_5 = - 1 ;
  int var_7 = 0 , var_9 = var_0 . length - 1 ;
  while ( var_7 <= var_9 ) {
    int var_11 = var_7 + ( var_9 - var_7 ) / 2 ;
    if ( var_0 [ var_11 ] == var_1 ) {
      var_5 = var_11 ;
      if ( var_3 ) var_9 = var_11 - 1 ;
      else var_7 = var_11 + 1 ;
    }
    else if ( var_0 [ var_11 ] < var_1 ) {
      var_7 = var_11 + 1 ;
    }
    else var_9 = var_11 - 1 ;
  }
  return var_5 ;
}
