public class Test {


public static void main(String[] args) {
  String str="1,2,3,4,5,6";
  String[] s=str.split(",");
  Arrays.sort(s);//升序
  for(String show:s){
  System.out.print(show+" ");//1 2 3 4 5 6
  }
  System.out.println();
  swapArray(s);//降序
  for(String show:s){
    System.out.print(show+" ");//6 5 4 3 2 1 
  }
}
private static void swapArray(String[] s) {
  int len=s.length;
  //折半,两端交换
  for(int i=0;i<len/2;i++){
    String temp=s[i];
    s[i]=s[len-1-i];
    s[len-1-i]=temp;
  }
}


}