I have changed it to long still error is coming

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);

	int tc = scn.nextInt();

	while (tc > 0) {
		
		int n = scn.nextInt();
		int[] arr = new int[n];

		for (int i = 0; i < arr.length; i++)
			arr[i] = scn.nextInt();

		bubbleSort(arr);

		for (int val : arr)
			System.out.print(val);

		System.out.println();

		tc--;
	}

}

public static void bubbleSort(int[] arr) {

	int n = arr.length;

	for (int count = 0; count <= n - 2; count++) {

		for (int j = 0; j <= n - count - 2; j++) {

			if (compare(arr[j], arr[j + 1])) {

				// swap
				int temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}

	}

}

public static boolean compare(int n1, int n2) {

	String n1n2s = n1 + "" + n2;
	String n2n1s = n2 + "" + n1;

    long n1n2i = Integer.parseInt(n1n2s);
	long n2n1i = Integer.parseInt(n2n1s);

	if (n2n1i > n1n2i) {
		return true;
	} else {
		return false;
	

}

}
}

@asthaaggarwal2,

https://ide.codingblocks.com/s/222627 Corrected code.

You need to change it to:

	long n1n2i = Long.parseLong(n1n2s);
	long n2n1i = Long.parseLong(n2n1s);

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.