For this Question: Bruce Banner is working on a code involving 3 numbers with their sum as a mystery number. Just then the emergency alarm is sounded and Bruce hulks his way out to save the city of New York yet again. The responsibility of cracking the code is then handed over to you since it is crucial to ensure Hulk’s safety. You find the mystery number as X. Now give Hulk a number of all the triplets and help Hulk as he fights the evil Chitauri.First line of input contains a single integer N (length of the array)
second line contain the array elements 
third line contain a single integer K(sum)

Constraint:-
1<=N<=1000
1<=elements<=100000
1<=K<=100000Output a single line containing the number of required tripletsSample Input:
6
1 2 3 4 5 6
8

Sample Output:-
2

Explanation:-
(1,2,5) , (1,3,4) are the required triplets
 , I have written this Solution Code: import java.io.*;
import java.util.*;

class Main {
	public static void main (String[] args) 
	{
		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 x = sc.nextInt();
		int cnt = 0, sum = 0;
		for(int i=0;i<n-2;i++)
		{
            if(arr[i]>x)
            {break;}
            int tar=x-arr[i];
            int j=i+1,k=n-1;
            while(j<k){
                
                if((arr[j]+arr[k])<tar){j++;}
                else if((arr[j]+arr[k])>tar){k--;}
                else{cnt++;j++;}
            }
	    }
	    
	    System.out.println(cnt);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?