convert any whitespace in entire string to space java code example Example: remove space string java a = a.replaceAll("\\s+", "");