code: public static DecoratedKey getMinimalKey(DecoratedKey key)
      {
          return key.getKey().position() > 0 || key.getKey().hasRemaining() || !key.getKey().hasArray()
                                         ? new BufferDecoratedKey(key.getToken(), HeapAllocator.instance.clone(key.getKey()))
                                         : key;
      }
docs: If the given @param key occupies only part of a larger buffer, allocate a new buffer that is only
  as large as necessary.