java version of wordcount