> if (q < input.length()) { // Ah, a dot!
> out.append('.');
> }
> p = q + 1;
Using
if (q != input.length())
should be even better. The searchDots method clearly specifies that "or
if there is no dots, return the length of input string".
--Max