For this Question: Given an array Arr of N elements. Find the maximum value of GCD(Arr[i], Arr[j]) where i != j.First line of input contains a single integer N.
Second line of input contains N space separated integers, denoting array Arr.

Constraints:
2 <= N <= 100000
1 <= Arr[i] <= 100000Print the maximum value of GCD(Arr[i], Arr[j]) where i != j.Sample Input 1
5
2 4 5 2 2 

Sample Output 1
2

Explanation: We can select index 1 and index 4, GCD(2, 2) = 2

Sample Input 2
6
4 3 4 1 6 5 

Sample Output 2
4, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	static int result(int a[],int n)
	{
      int maxe =0;
	  for(int i=0;i<n;i++)
	  maxe = Math.max(maxe,a[i]);

	  int count[]=new int[maxe+1];

	  for(int i=0;i<n;i++)
	  {
		  for(int j=1;j<Math.sqrt(a[i]);j++)
		  {
			  if(a[i]%j==0)
			  {
				  count[j]++;
				   if (j != a[i] / j)
                        count[a[i] / j]++;
			  }
		  }
	  }
	  for(int i=maxe;i>0;i--)
	  {
         if(count[i]>1)
		   return i;
	  }
	  return 1;
	}

	public static void main (String[] args) throws IOException{

	InputStreamReader i = new InputStreamReader(System.in);
	BufferedReader br = new BufferedReader(i);
	int n = Integer.parseInt(br.readLine());
	int a[] = new int[n];

	String str = br.readLine();
	String[] strs = str.trim().split(" ");
    for (int j = 0; j < n; j++)
	{
    a[j] = Integer.parseInt(strs[j]);
    }

	System.out.println(result(a,n));
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?