Java Arrays排序short类型


Java Arrays排序short类型

package com.codingdict;

import java.util.Arrays;

public class ArrayDemo {
   public static void main(String[] args) {

      // initializing unsorted short array
      short sArr[] = {22, 10, 9, 62, 5};

      // let us print all the elements available in list
      for (short number : sArr) {
         System.out.println("Number = " + number);
      }

      // sorting array
      Arrays.sort(sArr);

      // let us print all the elements available in list
      System.out.println("The sorted short array is:");
      for (short number : sArr) {
         System.out.println("Number = " + number);
      }
   }
}