What is the problem in my code

import java.util.;
import java.util.
;
public class Main {
public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();

	int[] arr = new int[n];
	for(int i=0;i<n;i++){
		arr[i] = sc.nextInt();
	}

int[] ans = merge(arr,0,n-1);
for(int val: ans){
System.out.println(val);
}

}

public static int[] merge(int[] arr ,int l,int r){
	if(l == r){
		int[] bc = new int[1];
		bc[0] = arr[l];
		return bc;
	}
	int mid =  (l+r)/2;

	int[] fsh = merge(arr,l,mid);
	int[] ssh = merge(arr,mid+1,r);

	return mergeTwoArray(fsh,ssh);
}

public static int[] mergeTwoArray(int[] arr1 ,int[] arr2){
	int[] arr = new int[arr1.length + arr2.length];
	int i=0,j=0,k=0;

	while(i<arr1.length && j<arr2.length){

		if(arr1[i]<=arr2[j]){
			arr[k] = arr[i];
			i++;
			k++;
		}else if(arr1[i]>arr2[j]){
			arr[k] = arr[j];
			k++;
			j++;
		}
	}

	while(i<arr1.length){
		arr[k] = arr[i];
		i++;
		k++;
	}

	while(j<arr2.length){
		arr[k] = arr[j];
		k++;
		j++;
	}

	return arr;

}

}

Hey @ParagKumar
In mergeTwoArray Function
if(arr1[i]<=arr2[j]){
arr[k] = arr[i];// Instead of arr[k] = arr1[i];
i++;
k++;
}
Same issue
else if(arr1[i]>arr2[j]){
arr[k] = arr[j]; Instead of arr[k] = arr2[j];
k++;
j++;
}
last Point In main Function

System.out.println(val); Instead of System.out.print(val+" ");