public static String rTrim(final String value) {
        if (value == null) {
            return null;
        }

        String trimmed = value;
        int offset = value.length() - 1;
        while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) {
            offset--;
        }

        if (offset < value.length() - 1) {
            trimmed = value.substring(0, offset + 1);
        }

        return trimmed;
    }
public static String rTrim ( final String value ) { if ( value == null ) { return null ; } String trimmed = value ; int offset = value . length ( ) - 1 ; while ( offset > - 1 && ( value . charAt ( offset ) == ' ' || value . charAt ( offset ) == '\t' ) ) { offset -- ; } if ( offset < value . length ( ) - 1 ) { trimmed = value . substring ( 0 , offset + 1 ) ; } return trimmed ; }
Removes empty space from the end of a string

@param value -
to be trimmed
@return String