code: public static String removeWhiteSpace(String s)
     {
        String retn = null;
  
        if (s != null)
        {
           int len = s.length();
           StringBuffer sbuf = new StringBuffer(len);
  
           for (int i = 0; i < len; i++)
           {
              char c = s.charAt(i);
  
              if (!Character.isWhitespace(c))
                 sbuf.append(c);
           }
           retn = sbuf.toString();
        }
        return retn;
     }
docs: Returns a new string with all the whitespace removed
  
  @param s the source string
  @return the string without whitespace or null