Sort game error tle

package challenges;

import java.util.Comparator;
import java.util.Scanner;

public class Aarrayssortgame implements Comparable {
String name;
int salary;

public Aarrayssortgame(String name, int salary) {
	this.name = name;
	this.salary = salary;
}

@Override
public String toString() {
	return this.name + " " + this.salary;
}

@Override
public int compareTo(Aarrayssortgame other) {
	return this.salary - other.salary;
}

// public class salcomparator implements Comparator {
// @Override
// public int compare(Aarrayssortgame tsal, Aarrayssortgame osal) {
// // TODO Auto-generated method stub
// return tsal.salary - osal.salary;
// }
// }
//
// public class namecomparator implements Comparator {
// @Override
// public int compare(Aarrayssortgame tname, Aarrayssortgame oname) {
// // TODO Auto-generated method stub
// return tname.name.compareTo(oname.name);
// }
//
// }

public static <T extends Comparable<T>> void bubblesort(T[] arr) {
	for (int i = 0; i < arr.length - 1; i++) {
		for (int j = 0; j < arr.length - i - 1; j++) {
			if ((arr[j].compareTo(arr[j + 1])) < 0) {
				T temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;

			}

		}
	}

}

public static void main(String[] args) {
	Scanner scn = new Scanner(System.in);
	// System.out.println("Enter max salary");
	int maxsal = scn.nextInt();
	// System.out.println("Enter number of inputs");
	int n = scn.nextInt();

	Aarrayssortgame[] sortgame = new Aarrayssortgame[n];
	for (int i = 0; i < n; i++) {
		// System.out.println("Enter name of"+ i +"employee");
		String name = scn.next();
		// System.out.println("Enter salary of"+ i +"employee");
		int salary = scn.nextInt();
		sortgame[i] = new Aarrayssortgame(name, salary);
	}
	bubblesort(sortgame);

// for (int i = 0; i < n; i++) {
// System.out.println(sortgame[i]);
// }
for (int i = 0; i < 3; ++i) {
for (int j = i + 1; j < 4; ++j) {
if (sortgame[i].salary == sortgame[j].salary) {
if (sortgame[i].name.compareTo(sortgame[j].name) > 0) {
Aarrayssortgame temp = sortgame[i];
sortgame[i] = sortgame[j];
sortgame[j] = temp;
}
}
}
}
// for (int i = 0; i < n; i++) {
// System.out.println(sortgame[i]);
// }
for (int i = 0; i < n; i++) {
// System.out.println(sortgame[i]);
if (sortgame[i].salary >= maxsal) {
System.out.println(sortgame[i]);
}
}
}

}
here is my code it is showing answers for custom inputs but not for the testcases but giving tle for 1 case