private void add() { int i = 0; while (i < count) { Random rand = new Random(); int r = rand.nextInt(50); if (!hashMap.containsKey(r)) { hashMap.put(r, r); i++; } } }