output is right, but can't pass the last task. pls help,thanks.
111
98
98
98
97
89
71
46
45
42
17
16
12
10
9
5
4
3
-9
-150
package zh.codegym.task.task07.task0728;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
降序
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] array = new int[20];
for (int i = 0; i < 20; i++) {
array[i] = Integer.parseInt(reader.readLine());
}
sort(array);
for (int x : array) {
System.out.println(x);
}
}
public static void sort(int[] array) {
//在此编写你的代码
int j,tmp;
for(int i = array.length-2 ; i >= 0; i--)
{
j = i+1;
tmp = array[i];
while(j < array.length-1 && array[j] >= tmp)
{
array[j-1] = array[j];
j += 1;
}
array[j-1] = tmp;
}
}
}