Java Sort long Array Example
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);
}
long[] l2 = new long[] { 5, 2, 3, 1, 4 };
Arrays.sort(l2, 1, 4);
for (long l: l2){
System.out.print(" " + l);
}
}
}
Related examples in the same category