I get an error out of bounds in my second for loop. Any advice on what I'm doin wrong? Maybe I didn't make the array big enough?
private static void mergeSort(int length, int[] arr) {
    if (length>1)
    {
        int h = (int) Math.floor(length/2);
        int m = length-h;
        int[] U= new int[h];
        int[] V=new int[m];
        for(int i=0; i<h; i++){
            U[i]=arr[i];
        }
        for(int i=h; i<length; i++){
            V[i]=arr[i];
        }
        mergeSort( h , U);
        mergeSort(m ,V);
        merge(h , m , U , V, arr);
    }
 
    