Sort long Array in Java
Description
The following code shows how to sort long Array.
Example
//from ww w.j a v a 2 s . c o m
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
long[] l1 = new long[] { 3L, 2L, 5L, 4L, 1L };
for (long l: l1){
System.out.print(" " + l);
}
Arrays.sort(l1);
for (long l: l1){
System.out.print(" " + l);
}
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »