Bubble sort를 이용하는 sorting 문제
import java.util.Comparator;
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;
public class Main{
public static int[] arr;
public static void main(String args[]) throws IOException {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr= new int[n];
for(int i=0;i<n;i++){
arr[i] = in.nextInt();
}
for(int i=1;i<n;i++){
for(int j=0;j<n-1;j++){
if(arr[j]>arr[j+1]){
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
for(int i=0;i<n;i++){
System.out.println(arr[i]);
}
}
}