For this Question: Given an array of integers of size N. Print the third largest integer in the array in linear time.
Third largest element of the array is the third number in the array when sorted in non- increasing order.A single integer n.
Next line contains n integers separated by space.

<b>Constraints </b>
3 <= n <= 10<sup>5</sup>
-10<sup>9</sup> <= arr[i] <= 10<sup>9</sup>A single integer denoting required answer.Input:
6
-2 7 3 1 6 5

Output:
5

Explanation :
sort in non- increasing order : 7 6 5 3 1 -2, I have written this Solution Code: import java.io.*;
import java.util.*;


public class Main {
    


    public static void main(String[] args) {
        
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);

        int n=Integer.parseInt(in.next());
       
        int a[] = new int[n];
        for(int i=0;i<n;i++){
            a[i]=Integer.parseInt(in.next());
        }
        int x=-1,y=-1,z=-1;
        for(int i=0;i<n;i++){
           if(x==-1 || a[i] >= a[x]){
               z=y;
               y=x;
               x=i;
           }
           else if(y==-1 || a[i] >= a[y]){
               z=y;
               y=i;
           }
           else if(z == -1 || a[i] >= a[z]){
               z=i;
           }
        }
        out.print(a[z]);
        out.close();
    }

    
    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

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