private static String trimRight(@Nonnull final String text){
  return text.replaceAll("\\s+$","");
}

private static String trimRight ( @ Nonnull final String text ) { return text . replaceAll ( "\\s+$" , "" ) ; }
trims the whitespace at the end of the given string .
