For this Question: Given an array of N elements where N is even. You have to pair up the elements into N/2 pairs such that each element is in exactly 1 pair. You need to find minimum possible X such that there exists a way to pair the N elements and for no pair sum of its elements is greater than X.First line contains N.
Second line contains N space separated integers, denoting array.

Constraints:
1 <= N <= 100000
1 <= elements of the array <= 1000000000Print a single integer, minimum possible X.Sample Input 
4
3 1 1 4

Sample Output
5

Explanation: we can pair (1, 3) and (1, 4) so all pairs have sum less than or equal to 5., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	static int[]sort(int n, int a[]){
		int i,key;
		for(int j=1;j<n;j++){
			key=a[j];
			i=j-1;
			while(i>=0 && a[i]>key){
				a[i+1]=a[i];
				i=i-1;
			}
			a[i+1]=key;
		}
		return a;
	}
	public static void main (String[] args) throws IOException {
		InputStreamReader io = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(io);
		int n = Integer.parseInt(br.readLine());
		String str = br.readLine();
		String stra[] = str.trim().split(" ");
		int a[] = new int[n];
		for(int i=0;i<n;i++){
			a[i] = Integer.parseInt(stra[i]);
		}
		a=sort(n,a);
	    int max=0;
	    for(int i=0;i<n;i++)
	    {
		    if(a[i]+a[n-i-1]>max)
		    {
			  max=a[i]+a[n-i-1];
		    }
	    }
         System.out.println(max);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?