Java 8 Retire los espacios de la cadena
a.replaceAll("\\s+","");
2 Programmers 1 Bug
a.replaceAll("\\s+","");
String withSpaces = " Hi ";
String withoutSpaces = withSpaces.trim();
String str = "Hello ";
System.out.println(str.trim()); // "Hello"