code: public static String shrink(String string) {
  		if (string == null) {
  			return null;
  		}
  		string = string.trim();
  		return SHRINK.matcher(string).replaceAll(" ");
  	}
docs: Trims the string and replaces runs of whitespace with a single space.