while(count<=50){ int num =new Random().nextInt(6)+1; tm.put(num, !tm.containsKey(num)?1 : tm.get(Key)+1); count++; }