   strange merge sort (NEED HELP)
  I've been working implementing mergeSort for class, but for some reason my code keeps outputting the input. I've been mining through the web looking for the right algorithm and I've used them all and the output remains the same.The output for this particular alg is the number of comparisons, but when I put it in a driver function and output the array, it comes out in the same order it came in, but number of comparisons > 0.My language is java.I understand that java uses pass-by-value, but I know that you can still manipulate objects and arrays because I tested it out before doing this alg.<code>import java.util.*;public class MergeSort{    //total number of comparisons    private int count;    //l parameter is the left most index and r is the right more index    public int mergeSort(int[] array, int l, int r)    {int mid = (l+r)/2;if(l==r)    {return 0;    }mergeSort(array,l,mid);mergeSort(array,mid+1,r);return merge(array,l,mid+1,r);    }    private int merge(int[] array, int l, int m, int r)    {//size of temp arrayint size = (r-l)+1;   //temp array to contain ordered elementsint tempArray[] = new int[size];//mid valueint mid = m-1;   //temp array index    int temp = 0;   //puts both sides together while putting them in orderwhile( (l <= mid) && (m <= r))    {if(array[l] <= array[m])    {tempArray[temp++]=array[l++];count++;    }else    {tempArray[temp++] = array[m++];count++;    }    }//copies over the rest of the arraywhile(l <= mid)    {tempArray[temp++] = array[l++];    }while(m <= r)    {tempArray[temp++] = array[m++];    }for(int i = l; i <= r; i++)    {System.out.print(tempArray[i-l]+" ");array = tempArray[i-l];    }System.out.println();return count;    }}</code>