public static int search(int current, Integer[] list, boolean galloping) {

		if (list == null || list.length == 0
				|| list[list.length - 1] < current) {
			return -1;
		}

		if (list[0] > current) {
			return list[0];
		}

		int low = 0, high = 0;
		int jump = 1;

		if (galloping) {
			// Through galloping, find a slot for binary search
			while ((high < list.length) && list[high] <= current) {

				low = high;
				// increase step size
				jump = jump << 1;
				high += jump;
			}

			if (high > (list.length - 1)) {
				high = list.length - 1;
			}
		} else {
			high = list.length - 1;
		}

		return binarySearch(list, low, high, current);
	}