Java Arrays.sort(long[] a)
Syntax
Arrays.sort(long[] a) has the following syntax.
public static void sort(long[] a)
Example
In the following code shows how to use Arrays.sort(long[] a) method.
//w w w.j a v a 2 s . c o m
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// initializing unsorted long array
long lArr[] = {221, 10, 111, 62, 46};
System.out.println(Arrays.toString(lArr));
// sorting array
Arrays.sort(lArr);
System.out.println(Arrays.toString(lArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »