Java数组排序long类型


Java数组排序long类型

package com.codingdict;



import java.util.Arrays;



public class ArrayDemo {

   public static void main(String[] args) {



      // initializing unsorted long array

      long lArr[] = {31, 13, 12, 98, 11};



      // let us print all the elements available in list

      for (long number : lArr) {

         System.out.println("Number = " + number);

      }



      // sorting array from index 1 to 3

      Arrays.sort(lArr, 1, 3);



      // let us print all the elements available in list

      System.out.println("long array with some sorted values(1 to 3) is:");

      for (long number : lArr) {

         System.out.println("Number = " + number);

      }

   }

}