public static void maxHeapify(int[] A, int i, int heapSize){
		int left = 2 * i + 1;
		int right = 2 * i + 2;
		
		//find the largest in A[i],A[left],A[right]
		int largest = i;
		if(left < heapSize && A[left] > A[largest]){
			largest = left;
		}
		if(right < heapSize && A[right] > A[largest]){
			largest = right;
		}
		
		if(largest != i){
			//exchange A[i] and A[largest]
			int temp = A[i];
			A[i] = A[largest];
			A[largest] = temp;
			
			maxHeapify(A,largest,heapSize);
		}
	
	}