Deeply sorry, Posted advice without checking it on my own System! Although suggestions I pointed towards were needed, It was not a clear-cut (Quote: Few second Job) like I said.
Look into the split method of the String class:
String (Java 2 Platform SE v1.4.2)
By splitting up your sentence, and storing it into a String Array, you can easily go through the array comparing lengths with only a fraction of your code.
The parameter of split() is something you consider to be a good checkpoint to split the string, such as : or a whitespace
Click here for details on for loops
Click here for an example of String.split() in action.
Again, very sorry for not checking my post before saying It was a 2 second job for you