Skip to content

Instantly share code, notes, and snippets.

@seratch
Created November 9, 2011 12:57
Show Gist options
  • Save seratch/1351345 to your computer and use it in GitHub Desktop.
Save seratch/1351345 to your computer and use it in GitHub Desktop.
Example2.java #daimonscala 21
import java.util.Arrays;
import java.util.Comparator;
public class Example2 {
public static void main(String[] args) {
Integer[] arr = new Integer[]{1, 5, 3, 2, 4};
Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
return o1 - o2;
}
});
for (Integer i : arr) {
System.out.println(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment