java remove white space in middle of string code example Example: remove space string java a = a.replaceAll("\\s+", "");