SIGTSTP error

The solution I did is working for the second test case with array size 3 but array size greater than 3 is showing sigtstp error.

the question is

please someone help here is my solution

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef {
    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t--> 0) {
            int n = sc.nextInt();
            int a[] = new int[n];
            for(int k=0;k<a.length;k++)
            {
                a[k]=sc.nextInt();
            }
            int r, temp, sum = 0, count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = i; j < n; j++) {
                    int xornum = a[i] ^ a[j];
                    temp = xornum;
                    while (xornum > 0) {
                        r = n % 10;
                        sum = (sum * 10) + r;
                        n = n / 10;
                    }
                    if (temp == sum) {
                        count++;
                    }
                }
            }
            System.out.println(count);
        }
    }
}