public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
System.out.println(“Enter the elements”);
for (int i = 0; i < arr.length; i++) {
arr[i] = sc.nextInt();
}
bubblesort(arr);
Display(arr);
}
public static void bubblesort(int arr[]) {
for (int counter = 0; counter < arr.length - 1; counter++) {
for (int j = 0; j < arr.length - 1 - counter; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
public static void Display(int[] arr) {
for (int i = 0; i < arr.length; i++) {
System.out.println(arr[i]);
}
}
Why my all the test cases are getting failed.