private static void maxheap(List<Element> a, int i) {
        left = 2 * i;
        right = 2 * i + 1;

        if (left <= n && a.get(left).getValue() > a.get(i).getValue()) {
            temp = a.get(left).getNumberOfComparison();
            a.get(left).setNumberOfComparison(++temp);
            temp = a.get(i).getNumberOfComparison();
            a.get(i).setNumberOfComparison(++temp);

            largest = left;
        } else {
            temp = a.get(largest).getNumberOfComparison();
            a.get(largest).setNumberOfComparison(++temp);
            temp = a.get(i).getNumberOfComparison();
            a.get(i).setNumberOfComparison(++temp);

            largest = i;
        }

        if (right <= n && a.get(right).getValue() > a.get(largest).getValue()) {

            temp = a.get(right).getNumberOfComparison();
            a.get(right).setNumberOfComparison(++temp);
            temp = a.get(largest).getNumberOfComparison();
            a.get(largest).setNumberOfComparison(++temp);

            largest = right;
        }
        if (largest != i) {
            Collections.swap(a, i, largest);

            // Update number of sitches
            /*
            temp = a.get(i).getNumberOfInversion();
            a.get(i).setNumberOfInversion(++temp);
            temp = a.get(largest).getNumberOfInversion();
            a.get(largest).setNumberOfInversion(++temp);
            */
            maxheap(a, largest);
        }
    }