package lx.day3;
import java.util.Arrays;
public class zy8 {
public static void main(String[] args) {
int[] a = {9, 8, 7, 6, 5, 4, 3, 2, 1};
int m=a[4];
int i=0;
int j=8;
int c=0;
while (c<9) {
while (i != j) {
if (a[i] > m) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
j--;
i++;
if(a[j]<m){
int temp1 = a[i];
a[i] = a[j];
a[j] = temp1;
i++;
j--;
}else {
j--;
}
} else {
i++;
}
}
c++;
int temp2 = a[0];
m= a[0];
a[0] = temp2;
}
for (int a1:a){
System.out.println(a1);
}
}
}