code: public Slice slice(int index, int length)
      {
          if (index == 0 && length == this.length) {
              return this;
          }
  
          checkPositionIndexes(index, index + length, this.length);
          if (index >= 0 && length == 0) {
              return Slices.EMPTY_SLICE;
          }
          return new Slice(data, offset + index, length);
      }
docs: Returns a slice of this buffer's sub-region. Modifying the content of
  the returned buffer or this buffer affects each other's content while
  they maintain separate indexes and marks.