question: private int countNonNewline ( String str , int off , int len ) { for ( int cnt = 0 ; cnt < len ; cnt ++ ) { final int pos = off + cnt ; if ( str . charAt ( pos ) == UNIX_NEWLINE ) { return cnt ; } if ( str . charAt ( pos ) == CARRIAGE_RETURN ) { return cnt ; } } return len ; }
target:  Count the number of non-newline characters before first newline in the string.