I have one array list
ArrayList itemListWithRank = ItemListDAO.getItemList();
and in arraylist itemListWithRank there are lot
itemListWithRank
Collections.sort(itemListWithRank ,new Comparator() { public int compare(Person o1, Person o2) { return Integer.valueOf(o1.id).compareTo(Integer.valueOf(o2.id)); } });