public static String getSelection ( byte [ ] message , int [ ] offsets ) { if ( offsets == null || message == null ) return "" ; if ( offsets . length < 2 || offsets [ 0 ] == offsets [ 1 ] ) return "" ; byte [ ] selection = Arrays . copyOfRange ( message , offsets [ 0 ] , offsets [ 1 ] ) ; return new String ( selection ) ; }
Returns the user - selected text in the passed array .