title: Merge Sort Comparison Counter
body: <p>I cant seem to figure out where to put my comparison counter in the Merge class. Although it sorts the array perfectly, it will not count the number of swaps (or comparisons) it made. Please help this is apart of my final project</p>
  
  <pre><code>      public static int mergeSort(int[] intArray, int first, int last) {
          if(first &lt; last) {
            int mid = (first + last) / 2;
            mergeSort(intArray, first, mid);
            mergeSort(intArray, mid + 1, last);
            Merge(intArray, first, mid, last);
  
       }
  
       return comparisons;
  
    }
  
    public static int Merge(int[] intArray, int first, int mid, int last) {
  
       //int count = 0;
       comparisons = 0;
       int first1 = first, last1 = mid;
       int first2 = mid + 1, last2 = last;
       int temp[] = new int[intArray.length];
       int index = first1;
  
       while(first1 &lt;= last1 &amp;&amp; first2 &lt;= last2) {
          if(intArray[first1] &lt; intArray[first2]) {
             temp[index] = intArray[first1++];
             comparisons++;
          }
          else
              temp[index] = intArray[first2++];
              index++;
              comparisons++;
       }
  
       while(first1 &lt;= last1)
          temp[index++] = intArray[first1++];
  
       while(first2 &lt;= last2)
          temp[index++] = intArray[first2++];
  
       for(index = first; index &lt;= last; index++)
          intArray[index] = temp[index];
  
  
       return comparisons;
    }
  </code></pre>