question: public static int findEndTrimNewlineChars ( CharSequence s ) { for ( int i = s . length ( ) ; i > 0 ; ) { if ( s . charAt ( i - 1 ) != '\n' ) { return i ; } i -- ; if ( i > 0 && s . charAt ( i - 1 ) == '\r' ) { i -- ; } } return 0 ; }
target:  Finds and returns the end of the given character sequence after trimming new line characters from the right. The following character sequences are treated as newline characters: "\n", "\r\n".