code: public static String stripWhitespace(String input) {
      StringBuilder output = new StringBuilder();
      for (int i = 0; i < input.length(); i++) {
        char current = input.charAt(i);
        if (!Character.isWhitespace(current))
          output.append(current);
      }
      return output.toString();
    }
docs: Strips all characters c satisfying Character.isWhitespace(c).