merge sort  solution
\n public int[] sortArray(int[] nums) {\n        mergeSort(nums, 0, nums.length - 1);\n        return nums;\n    }\n\n    private void mergeSort(int[] array, in
```\n public int[] sortArray(int[] nums) {\n        mergeSort(nums, 0, nums.length - 1);\n        return nums;\n    }\n\n    private void mergeSort(int[] array, int left, int right) {\n        if (left < right) {\n            var middle = left + (right - left) / 2;\n\n            mergeSort(array, left, middle);\n            mergeSort(array, middle + 1, right);\n\n            merge(array, left, middle, right);\n        }\n    }\n    \n    \n    private void merge(int[] array, int left, int middle, int right) {\n        int n1 = middle - left + 1;\n        int n2 = right - middle;\n\n        int[] leftArray = new int[n1];\n        int[] rightArray = new int[n2];\n\n        for (int i = 0; i < n1; ++i)\n            leftArray[i] = array[i+left];\n\n        for (int j = 0; j < n2; ++j)\n            rightArray[j] = array[middle + j + 1];\n\n        int i = 0, j = 0, k = left;\n\n        while (i < n1 && j < n2) {\n            if (leftArray[i] <= rightArray[j]) {\n                array[k] = leftArray[i];\n                i++;\n            }\n            else {\n                array[k] = rightArray[j];\n                j++;\n            }\n            k++;\n\n        }\n\n        while (i < n1) {\n            array[k] = leftArray[i];\n            k++;\n            i++;\n        }\n\n        while (j < n2) {\n            array[k] = rightArray[j];\n            j++;\n            k++;\n\n        }\n\n    }\n```
['Java']