Merge sort(not able to find the error)

public class Mergerecursion
{
public static void main(String[] args)
{
int[] arr={20,10,30,50,60,5,80,25};
int[] ans= mergeSort(arr, 0, arr.length-1);
for(int val: ans)
{
System.out.println(val+" ");
}

}


public static int[] mergeTwoSortedArrays(int[] arr1, int[] arr2)
{
    public static int[] mergeSort(int[] arr, int low, int high)
    {
        if(low==high)
        {
            int[] base= new int[1];
            base[0]=arr[0];
            return base;
        }
        int mid=(low+high)/2;

        int[] fh= mergeSort(arr, low, mid);
        int[] sh= mergeSort(arr, mid+1, high);

        int[] merge= mergeTwoSortedArrays(fh, sh);
        return merge;
    }
}

}

@jdkatti,
you have put a function inside a function.

public static int[] mergeTwoSortedArrays(int[] arr1, int[] arr2) this contains the function: public static int[] mergeSort(int[] arr, int low, int high). Which is not allowed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.