public void outHeapMax(ArrayList<Pair> priorityQueue) {

		if (size(priorityQueue) > 7) {

			int maxIndex1 = 1;
			int maxIndex2 = 2;
			int changeIndex = maxIndex1;

			Pair max1 = priorityQueue.get(maxIndex1);
			Pair max2 = priorityQueue.get(maxIndex2);

			int childIndex = 7;
			int childIndexOffset = childIndex;

			if (max1.p > max2.p) {
				childIndex = (2 * maxIndex1 + 1) + (2 * maxIndex1 + 1) + 1;
			} else {
				childIndex = (2 * maxIndex2 + 1) + (2 * maxIndex2 + 1) + 1;
				changeIndex = maxIndex2;
			}

			Pair bottom = bottom(priorityQueue);
			Pair grandChild2 = null;
			Pair grandChild3 = null;
			Pair grandChild4 = null;

			if (size(priorityQueue) > childIndexOffset + 1) {
				grandChild2 = priorityQueue.get(childIndexOffset + 1);
				if (grandChild2.p > priorityQueue.get(childIndex).p)
					childIndex = childIndexOffset + 1;
			}
			if (size(priorityQueue) > childIndexOffset + 2) {
				grandChild3 = priorityQueue.get(childIndexOffset + 2);
				if (grandChild3.p > priorityQueue.get(childIndex).p)
					childIndex = childIndexOffset + 2;
			}
			if (size(priorityQueue) > childIndexOffset + 3) {
				grandChild4 = priorityQueue.get(childIndexOffset + 3);
				if (grandChild4.p > priorityQueue.get(childIndex).p)
					childIndex = childIndexOffset + 3;
			}

			priorityQueue.set(changeIndex, priorityQueue.get(childIndex));
			priorityQueue.set(childIndex, bottom);
			priorityQueue.remove(priorityQueue.size() - 1);

			findChildren(priorityQueue, childIndex, true);
		}

	}