Java Arrays sort方法 - 根据索引排序字符


Java Arrays sort方法 - 根据索引排序字符

package com.codingdict;

import java.util.Arrays;

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

      // initializing unsorted char array
      char aArr[] = {'q','p','s','r'};

      // let us print all the values available in list
      for (char value : aArr) {
         System.out.println("Value = " + value);
      }

      // sorting array from index 0 to 3
      Arrays.sort(aArr, 0, 3);

      // let us print all the values available in list
      System.out.println("char array with some sorted values(0 to 3) is:");
      for (char number : aArr) {
         System.out.println("Number = " + number);
      }
   }
}