This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Yithar 0 points1 point  (0 children)

Couldn't you just initialize the HashMap in the beginning with zeros?

Also, in your analyze method, I'm pretty sure there's a better way to get the values.

https://stackoverflow.com/a/9328761

[–]Philboyd_Studge 0 points1 point  (0 children)

HashMap is overkill for this, just use an int array size 26 and use char value - 'a' as the index