private static <T extends Comparable<? super T>> void siftDown(T[] array, int start, int end) {
        int root = start;
        //While root has at least one child not past the end of the heap
        while (left_child(root) <= end) {
            //Find biggest child and swap up:

            //Start with left child
            int child = left_child(root);

            //Biggest so far
            int biggest = root;

            //If root is smaller than left child
            if (array[biggest].compareTo(array[child]) == -1) {
                biggest = child;
            }

            //If right child exists and is bigger than biggest so far
            if (child+1 <= end && array[biggest].compareTo(array[child+1]) == -1) {
                biggest = child + 1;
            }

            //Check if either of the children was bigger.
            if (biggest != root) {
                swap(array, root, biggest);
                root = biggest;
            } else {
                return;
            }
        }
    }