public static CharSequence trimTrailingWhitespace(CharSequence source){
  if (source == null)   return "";
  int i=source.length();
  while (--i >= 0 && Character.isWhitespace(source.charAt(i))) {
  }
  return source.subSequence(0,i + 1);
}

public static CharSequence trimTrailingWhitespace ( CharSequence source ) { if ( source == null ) return "" ; int i = source . length ( ) ; while ( -- i >= 0 && Character . isWhitespace ( source . charAt ( i ) ) ) { } return source . subSequence ( 0 , i + 1 ) ; }
trims trailing whitespace . removes any of these characters : 0009 , horizontal tabulation 000a , line feed 000b , vertical tabulation 000c , form feed 000d , carriage return 001c , file separator 001d , group separator 001e , record separator 001f , unit separator
