For this Question: You are given an unsorted array of length n and must sort it using merge sort while also printing the amount of merges that occur throughout the sorting process.The first line of input will be n, which represents the array's length, followed by the n array items in the second line.

Constraints:
0<= n <=100000First- line should be the sorted array and the second should be the number of mergers that occurs when the array is sorted using merge sort.Sample Input:
5
5 1 2 7 3

Output:
1 2 3 5 7 
4, I have written this Solution Code: import java.util.Scanner;

public class Main
{
    int noOfMerge=0;
    void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0,k=l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
            noOfMerge+=1;
        }
    }
    public static void main(String args[])
    {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] array=new int[n];
        for(int i=0;i<n;i++)
            array[i]=scanner.nextInt();
        Main ob = new Main();
        ob.sort(array, 0, n-1);
        for (int i=0; i<n; ++i)
            System.out.print(array[i] + " ");
        System.out.println();
        System.out.println(ob.noOfMerge);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?