int GetVal(int[] arry, int fval, int begin, int end) { if (Math.Abs(begin - end) == 1) return -1; int mid = (begin + end) / 2; if (arry[mid] < fval) return GetVal(arry, fval, mid, end); else if (arry[mid] > fval) return GetVal(arry, fval, begin, mid); else if (arry[mid] == fval) return arry[mid]; else return -1;//no result value }