private int offset ( long index ) { int offset = ( int ) ( index % buffer . length ) ; if ( offset < 0 ) { offset += buffer . length ; } return offset ; }
Returns the buffer index for the given offset .