java get all keys of hashmap in array code example Example: java hashmap get array of keys for (int key : myHashMap.keySet()){ // do stuff }