You can detect whether there's two (or more) consecutive spaces in a string, with:
if (testmessage.contains(" "))
// yes it does.
Keep in mind that you will also get a blank entry if the string starts or ends with a space so you may want to catch that as well:
if (
testmessage.contains(" ") ||
testmessage.startsWith(" ") ||
testmessage.endsWith(" ")
) {
// yes it does.
}
However, you can also use a regular expression in String.split() to make your word extraction work even when there are multiple consecutive spaces:
String[] words = testmessage.split(" +");
The regular expression shown above means one or more spaces, and as many as possible (greedy). This will unfortunately may still give an empty element at the start or end of the array but you can get around that by stripping off the leading and trailing spaces beforehand:
String[] words = testmessage.trim().split(" +");
You may also find it more flexible if you use \s rather than a literal space, since that will cover spaces, tabs, formfeeds and so on. If you know you're only wanting to split on spaces, that's not needed, but it's something you may want to keep in mind.