Update WordState.java

While loop implementation