Scanner sc = new Scanner(System.in);int num = sc.nextInt();if(num==1){ Arrays.sort(x);}
这个是从小到大排序。可以自己去实现一个sort算法。