For this Question: Given an integer array A of size N which is sorted. You are also given another integer array B of size M which may or may not be sorted but all the elements of B are distinct. Intersection of two arrays A and B is a sorted array C which contains only distinct elements and all elements of C are present in both A and B. Find the intersection of A and B.
Note: There is atleast one common element in A and B.First line contains an integer N.
Next line contains N space separated integers denoting elements of array A.
Next line contains an integer M.
Next line contains M space separated integers denoting elements of array B.

Constraints
1 <= N <= 10^5
0 <= Ai <= 10^5
1 <= M <= 10^5
0 <= Bi <= 10^5Print K space separated integers denoting the elements of array C - intersection of arrays A and B.Sample Input 1:
3
1 2 3
3
2 1 3

Output 
1 2 3

Explanation:
1,2 and 3 are present in both arrays.

Sample Input 2:
3
1 1 2
4
2 3 4 5

Output 
2

Explanation:
Only element 2 is common in both A and B., I have written this Solution Code: import java.io.*;
import java.util.*;
class Main
{
    static boolean binary_search(int[] a, int n, int tar) {
    	int l = 0;
    	int r = n - 1;
    	while (l <= r) {
    		int mid = (l + r) / 2;
    		if (a[mid] == tar) {
    			return true;
    		}
    		if (a[mid] < tar)l = mid + 1;
    		else r = mid - 1;
    	}
    	return false;
    }
    public static void main (String args[]) throws IOException
    {   
        BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        int a[] = new int[n];
        String line = br.readLine();
        String[] strs = line.trim().split("\\s+");
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(strs[i]);
        }
        int m=Integer.parseInt(br.readLine());
        int b[] = new int[m];
        line = br.readLine();
        strs = line.trim().split("\\s+");
        for (int i = 0; i < m; i++) {
            b[i] = Integer.parseInt(strs[i]);
        }
        ArrayList<Integer> ans = new ArrayList<Integer>(); 
    	for (int i = 0; i < m; i++) {
    		if (binary_search(a, n, b[i]))ans.add(b[i]);
    	}
    	Collections.sort(ans);
    	for (int i = 0; i < ans.size(); i++) 
            System.out.print(ans.get(i) + " "); 
    }
}

, In this Programming Language: Java, Now tell me if this Code is compilable or not?