Object[] key_arr = hashmap.keySet().toArray(); Arrays.sort(key_arr); for (Object key : key_arr) { Object value = hashmap.get(key); }