public static int[] heapSort(int[] array) {
		if(array == null || array.length <= 1) {
			return array;
		}
		
		buildMaxHeap(array);
		
		for(int heapSize = array.length; heapSize > 1; heapSize--) {
			swap(array, 0, heapSize - 1);
			maxHeapify(array, 0, heapSize - 1);
		}
		
		return array;
	}