public void sortArray() {

        this.arrayAccess = 0;
        this.comparisions = 0;

        heap.buildMaxHeap();

        for (int i = this.array.length - 1; i >= 0; i--) {
            try {
                this.array[i] = this.heap.pop();
                this.arrayAccess++;
            } catch (EmptyCollectionException e) {
                e.printStackTrace();
                throw new RuntimeException("Heap Sort Failed!!!");
            }
        }
        this.arrayAccess = heap.getArrayAccessCount();
        this.comparisions = heap.getComparisions();

        heap.resetArray(array);

    }