두번째 index를 기준으로
이전 숫자와 대소비교를 합니다.
그래서 자기의 위치를 찾습니다.
public class Main {
public static void main(String[] args) {
int [] insert = {5,4,3,2,1};
int j, b;
int temp;
for (int i= 1; i< insert.length; i++) {
j = i;
b = i;
while (j > 0) {
j = j - 1;
if (insert[b] < insert[j]) {
temp = insert[b];
insert[b] = insert[j];
insert[j] = temp;
b = b- 1;
}
}
System.out.println(""+insert[0] + insert[1] + insert[2] + insert[3] + insert[4]);
}
}
}