Java Arrays排序双索引


Java Arrays排序双索引

package com.codingdict;

import java.util.Arrays;

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

      // initializing unsorted double array
      double dArr[] = {3.1, 1.4, 2.7, 11.5, 8.7};

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

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

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