public void merge(int[] myList, int low1, int mid, int low2, int high)
    {
        /* check if stopButton has been selected */
        if(stopFlag == true)
        {
            return;
        }
            
        /* create a temp array to hold the sorted ints, initialize iterators etc. */
        int[] tempArray = new int[(mid - low1) + (high - low2) + 2];
        int s1 = low1;  /* starting point for lower half */
        int s2 = low2;  /* starting point for upper half */
        int d = 0;      /* index for tempArray */
        int k = 0;
        
        while(s1 <= mid && s2 <= high)  /* while elements remaining in BOTH halves */
        {
            /* compare one element from lower half with one element from upper half;
             * put the smaller of the two ints into tempArray */
            if(myList[s1] < myList[s2])
            {
                tempArray[d++] = myList[s1++];   
            }
            
            else
            {
                tempArray[d++] = myList[s2++];
            }
            
        }//end while(s1 <= mid && s2 <= high)
        
        /* at this point, either s1 has reached mid or s2 has reached high (ie one of the
         * two halves is exhausted), so copy whatever is left of the array half (that
         * hasn't been exhausted) into tempArray */
        
        /* copy over remaining elements in lower half of array if s1 isnt already at mid */
        while(s1 <= mid)
        {
            tempArray[d++] = myList[s1++];
        }
        
        /* copy over remaining elements in upper half of array if s2 isnt already at high */
        while(s2 <= high)
        {
            tempArray[d++] = myList[s2++];
        }
        
        /* copy merge-sorted tempArray over to myList */
        for(k = 0, s1 = low1; s1 <= high; s1++, k++)
        {
            myList[s1] = tempArray[k];
            repaint();
            
            try
            {
                sortThread.sleep(getMsSleepDuration());
            }
            catch(InterruptedException e)
            {
                System.out.println("Error: sleep interrupted" + e);
            }
            
        }//end for loop
                        
    }//end merge()