public void run() {
        int[] testArray = null;

        for (int i = 0; i < loops; i++) {
            // Get new random array and copy it for all the sorting algorithms,
            // Arrays.sort tests the original testArray
            testArray = randomizeArray();

            if (bubble) {
                int[] bubbleArray = Arrays.copyOf(testArray, arraySize);
                testBubble(bubbleArray, false);
            }

            if (merge) {
                int[] mergeArray = Arrays.copyOf(testArray, arraySize);
                testMerge(mergeArray, false);
            }

            if (heap) {
                int[] heapArray = Arrays.copyOf(testArray, arraySize);
                testHeap(heapArray, false);
            }

            if (quick) {
                int[] quickArray = Arrays.copyOf(testArray, arraySize);
                testQuick(quickArray, false);
            }

            if (counting) {
                int[] countArray = Arrays.copyOf(testArray, arraySize);
                testCounting(countArray, false);

            }

            if (standard) {
                testStandard(testArray, false);
            }

        }

        if (testSorted) {
            testSortedArrays(testArray);
        }

        calculateAverages();
        gui.setLabelTexts();
        bubbleTime = heapTime = mergeTime = quickTime = countingTime = standardTime = 0;
    }