private static int findMin(int[] array, int low, int high)
    {
        if (low < high) {
            int mid = low + (high - low) / 2;

            if (mid > low && array[mid] < array[mid - 1]) {
                return mid;
            }
            if (mid < high && array[mid + 1] < array[mid])
                return mid + 1;

            if (array[high] > array[mid]) {
                return findMin(array, low, mid - 1);
            } else if (array[high] < array[mid])
                return findMin(array, mid + 1, high);
            else {
                int a = findMin(array, mid + 1, high);
                int b = findMin(array, low, mid - 1);
                if (array[a] < array[b])
                    return a;
                else
                    return b;
            }
        }
        return low;
    }