private static <T extends Comparable<T>> void maxHeapify(T array[],
			int index, int heapSize) {

		int leftIndex = getLeftChildIndex(index);
		int rightIndex = getRightChildIndex(index);
		int largestIndex = index;

		if (leftIndex < heapSize
				&& array[index].compareTo(array[leftIndex]) == -1)
			largestIndex = leftIndex;

		if (rightIndex < heapSize
				&& array[largestIndex].compareTo(array[rightIndex]) == -1)
			largestIndex = rightIndex;

		if (largestIndex != index) {
			CollectionsHelper.swapValues(array, largestIndex, index);
			maxHeapify(array, largestIndex, heapSize);
		}

	}