For this Question: Given an array A of size N containing 0's, 1's and 2's. The task is to segregate the 0's, 1's and 2's in the array as all the 0's should appear in the first part of the array, 1's should appear in middle part of the array and finally all the 2's in the remaining part of the array.

Note: Do not use inbuilt sort function. Try to solve in O(N) per test caseThe first line contains an integer T denoting the total number of test cases. Then T testcases follow. 
Each testcases contains two lines of input. The first line denotes the size of the array N. 
The second lines contains the elements of the array A separated by spaces.

Constraints:
1 <= T <= 100
1 <= N <= 100000
0 <= Ai <= 2

Sum of N for each test case does not exceed 10^5For each testcase, in a newline, print the sorted array.Input :
2
5
0 2 1 2 0
3
0 1 0

Output:
0 0 1 2 2
0 0 1

Explanation:
Testcase 1: After segragating the 0s, 1s and 2s, we have 0 0 1 2 2 which shown in the output.
Testcase 2: For the given array input, output will be 0 0 1., I have written this Solution Code: import java.io.*;
import java.util.*;
class Main {
	public static void main (String[] args) throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out= new PrintWriter(System.out);
        int t=Integer.parseInt(br.readLine());
        while(t>0){
            t-=1;
            int n=Integer.parseInt(br.readLine());
            String s[]=br.readLine().split(" ");
            int arr[]=new int[n];
            int zero_counter=0,one_counter=0,two_counter=0;
            for(int i=0;i<n;i++){
                arr[i]=Integer.parseInt(s[i]);
                if(arr[i]==0)
                    zero_counter+=1;
                else if(arr[i]==1)
                    one_counter+=1;
                else
                    two_counter+=1;
            }
            for(int i=0;i<zero_counter;i++){
                out.print(0+" ");
            }
            for(int i=0;i<one_counter;i++){
                out.print(1+" ");
            }
            for(int i=0;i<two_counter;i++){
                out.print(2+" ");
            }
            out.flush();
            out.println(" ");
        }
        out.close();
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?