Help me to solve this code

import java.util.Scanner;

public class largestNumArray {
static Scanner s = new Scanner(System.in);
static int t;
public static void main(String[] args) {
// TODO Auto-generated method stub
t = s.nextInt();
String[][] arr = new String[t][];
for(int i=0; i<t; i++) {
arr[i] = takeInput();
findTheLargest(arr[i]);
}
printArray(arr);

}




private static void printArray(String[][] arr) {
	// TODO Auto-generated method stub
	for(int i=0; i<t; i++) {
		for(int j=0; j<arr[i].length; j++) {
			System.out.print(arr[i][j]);
		}
		System.out.println();
	}
	
}




private static void findTheLargest(String[] arr) {
	// TODO Auto-generated method stub
	for(int i=0; i<arr.length; i++) {
		for(int j=i+1; j<arr.length; j++) {
			String ij = arr[i] + arr[j];
			String ji = arr[j] + arr[i];
			if(checkParams(ij, ji)) {
				swap(arr, i , j);
			}
		}
	}
	
}




private static void swap(String[] arr, int i, int j) {
	// TODO Auto-generated method stub
	String temp = arr[i];
	arr[i]= arr[j];
	arr[j] = temp;
}




private static boolean checkParams(String ij, String ji) {
	// TODO Auto-generated method stub
	int ab = Integer.parseInt(ij);
	int ba = Integer.parseInt(ji);
	if(ba > ab) {
		return true;
	}
	return false;
}




private static String[] takeInput() {
	// TODO Auto-generated method stub
	int n = s.nextInt();
	String[] str = new String[n];
	for(int i=0; i<n; i++) {
		str[i] = s.next();
	}
	return str;
}

}

Hey @danyalkhan8271 You need to take input in the form of Integer not in String bcoz there are some test cases like " 12345678 " look for spaces before and after the number in the string and when you try to convert this String to an int in the checkParams Function then it will give number format exception bcoz spaces cannot be converted to int.So take input in Integer form.

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.