package sorting;
   
import java.util.Comparator;

public class StupidSort {
    public static void main(String[] args) {
	Comparator<Integer> ascending = new Comparator<Integer>() {
	    @Override
	    public int compare(Integer foo, Integer bar) {
		return foo - bar;
	    }
	};
	
	int[] array = {5, 4, 3, 2, 1};
	stupidSort(array, ascending);
	for (int x : array) {
	    System.out.println(x);
	}
    }
    
    public static void swap(int[] array, int foo, int bar) {
	int temp = array[foo];
	array[foo] = array[bar];
	array[bar] = temp;
    }

    public static void stupidSort(int[] array, Comparator<Integer> comparator) {
	for (int i = 0; i < array.length; i++) {
	    for (int j = i + 1; j < array.length; j++) {
		if (comparator.compare(array[i], array[j]) > 0) {
		    swap(array, i, j);
		}
	    } 
	}
    }
}
@@ -74,342 +74,8 @@
 t %7B%0A
-    public static void main(String%5B%5D args) %7B%0A%09Comparator%3CInteger%3E ascending = new Comparator%3CInteger%3E() %7B%0A%09    @Override%0A%09    public int compare(Integer foo, Integer bar) %7B%0A%09%09return foo - bar;%0A%09    %7D%0A%09%7D;%0A%09%0A%09int%5B%5D array = %7B5, 4, 3, 2, 1%7D;%0A%09stupidSort(array, ascending);%0A%09for (int x : array) %7B%0A%09    System.out.println(x);%0A%09%7D%0A    %7D%0A    %0A
     
@@ -478,10 +478,14 @@
 %09%7D%0A    %7D
+    
 %0A%7D

Drop main function as we are moving to Junit.