```java``
package com.homework;
/*
作者:李瑞茹
时间:2021.3.27
*/
public class Homework2 {
public static void main(String[] args) {
boolean Ling = false ;
int []array = new int[]{1,3,-1,5,-2};
int temp=0;
for (int i = 0; i < array.length; i++) {
for (int j = 1; j < (array.length-i); j++) {
if (array[j-1]>array[j]){
temp = array[j-1];
array[j-1]=array[j];
array[j]=temp;
Ling=true;
}
}
if (!Ling){
break;
}
}
for (int i = 0; i < 5; i++) {
System.out.println(array[i]);
}
}
}