public static void main(String args[]){
        Integer input[] = {5,2,8,9,9,9,2};
        SortArrayByFrequence saf = new SortArrayByFrequence();
        saf.sortByFrequence(input);
        for(int i : input){
            System.out.println(i + " ");
        }
    }
http://www.geeksforgeeks.org/sort-elements-by-frequency/
src/com/interview/sort/SortArrayByFrequence.java