String patternStr = "\s+";
String replaceStr = " ";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(senten);
senten = matcher.replaceAll(replaceStr);
“senten” is the string that has multiple whitespaces.
