the testcase 1 is showing timelimit while my code working fine the code is
static Scanner scn=new Scanner(System.in);
public static void main(String[] args) {
int[] array=takeinput();
bubblesort(array);
output(array);
}
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+1]<arr[j]) {
int temp= arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;
}
}
}
}
public static int[] takeinput() {
int n= scn.nextInt();
int[]arr=new int[n];
for(int i=0;i<arr.length;i++) {
arr[i]=scn.nextInt();
}
return arr;
}
public static void output(int[]arr) {
for(int i=0;i<=arr.length-1;i++) {
System.out.println(arr[i]);
}
}