public static void main(String[] args) 
    {
        System.out.println("Reading Array ...");
        ArrayList<Long> array = readNumbersArrayFromFile();
        System.out.println("Reading Array Completed ...");
        //SORT THE ARRAY
        Collections.sort(array);
        System.out.println("Sorting Completed ...");
        //WE DO USING ARRAYS INSTEAD OF NATIVE JAVA HASHMAP IN ORDER TO SPEED UP THE COMPUTATION
        int counter = 0;
        
        for(int sum = -10000; sum <= 10000; sum++)
        {   
            System.out.println("Sum :" +sum);
            int start = 0;
            int end = array.size() - 1;

            boolean found = false;

            while((found == false) && (start < end)) 
            {
		if(array.get(start) + array.get(end) == sum)
                {
                    if(array.get(start).longValue() != array.get(end).longValue()){
                        found = true;
                    }
                }
		else if(array.get(start) + array.get(end) > sum){
                    end--;
                }
		else if(array.get(start) + array.get(end) < sum){
                    start++;
                }
            }

            if(found){
                counter++;
            }
        }
        
        System.out.println("*** COUNTER => " + counter + " ***");
    }