Change the regex of split to also include new line characters...


String[] wordList = fileContents.split("[\\s\\n]");


Or, rather than placing a new line into the string when reading the...