Java Arrays sort方法 - 排序short


Java Arrays sort方法 - 排序short

package com.codingdict;

import java.util.Arrays;

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

      // initializing unsorted byte array
      byte bArr[] = {10,2,7,35};

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

      // sorting array
      Arrays.sort(bArr);

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