public static int[] searchRangeII(int[] A, int target) {
        int res[] = new int[2], bt, ed, mid;

        res[0] = res[1] = -1;

        bt = mid = 0;
        ed = A.length - 1;
        while (bt < ed) {
            mid = bt + ((ed - bt) >> 1);
            if (A[mid] < target) {
                bt = mid + 1;
            } else {
                ed = mid;
            }
        }

        if (A[bt] != target) {
            return res;
        } else {
            res[0] = bt;
        }

        bt = mid = 0;
        ed = A.length;
        while (bt < ed) {
            mid = bt + ((ed - bt) >> 1);
            if (A[mid] > target) {
                ed = mid;
            } else {
                bt = mid + 1;
            }
        }

        res[1] = ed - 1;

        return res;
    }