public static int bitonicSearch(Comparable[] a, int lo, int hi, Comparable t) {
        if (lo > hi) {
            return -1;
        }
        int mid = (lo + hi) / 2;
        final int compareToT = a[mid].compareTo(t);
        if (compareToT == 0) {
            return mid;
        } else if (compareToT == 1) { // mid bigger
            int find = bitonicSearch(a, mid + 1, hi, t);
            if (find == -1) {
                return bitonicSearch(a, lo, mid - 1, t);
            } else {
                return find;
            }
        } else {
            boolean leftMax = true;
            if (mid + 1 <= hi && a[mid].compareTo(a[mid + 1]) == -1) {
                leftMax = false;
            }
            if (leftMax) {
                return bitonicSearch(a, lo, mid - 1, t);
            } else {
                return bitonicSearch(a, mid + 1, hi, t);
            }
        }
    }