[AppleScript] 纯文本查看 复制代码
import java.util.Scanner;
public class Keep {
public static void main(String[] args) {
Scanner sj=new Scanner(System.in);
System.out.println("请手动输入一个整数");
int xin=sj.nextInt();
int[] ys={12,14,23,45,66,68,70,77,90,91};
int[] xs=new int[11];
int js=0;//定义一个新的索引序号
for(int a=0;a<ys.length;a++){
if(ys[a]<=xin){
js=a+1;
xs[a]=ys[a];
}else {
xs[a+1]=ys[a];
}
}
xs[js]=xin;
for(int a=0;a<xs.length;a++){
System.out.print(xs[a]+" ");
}
}
}
|