how to detect double and triple spaces in a string java code example Example: java remove double spaces StringUtils.normalizeSpace(string);