What is problem in my code

import java.util.*;
public class Main{
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr1[]=new int[n];
int arr2[]=new int[n];
for(int i=0;i<n;i++){
arr1[i]=sc.nextInt();
}
for(int i=0;i<n;i++){
arr2[i]=sc.nextInt();
}
PriorityQueue ans=intersect(arr1,arr2);
System.out.print("[");
while(!ans.isEmpty()) {
System.out.print(ans.remove()+" β€œ);
}
System.out.println(”]");

		 }
 public static PriorityQueue<Integer> intersect(int[] nums1, int[] nums2) {
        PriorityQueue<Integer> r=new PriorityQueue<>();
        HashMap<Integer, Integer> count = new HashMap<Integer, Integer>();
        for (int n: nums1) {
            if (!count.containsKey(n)) {
                count.put(n, 1);
            } else {
                count.put(n, count.get(n) + 1);
            }
        }
        for (int n: nums2) {
            if (count.containsKey(n)) {
                if (count.get(n) > 0) {
                    r.add(n);
                    count.put(n, count.get(n) - 1);
                }
            }
        }
        return r;
 }

}

Firstly, put commas in between the output elements and don’t leave a space after the last output element.

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.