private Pointer createAndAddFirstPointer() {
   Pointer first = new Pointer();
   first.setBlockNumber(0);
   first.setStart(0);
   first.setFree(true);
   first.setEnd(buffer.capacity() - 1);
   first.setNext(null);
   first.setPrev(null);
   pointers.add(first);
   return first;
 }
 /**
  * Resize an existing block to new capacity by slicing the <code>Pointer</code> pointed to by
  * existing pointer. The new <code>Pointer</code> is a slice present before the existing.
  *
  * @param existing points to existing Pointer(referring existing block).
  * @param capacity to be resized to.
  * @return Pointer to resized block.
  */
 private Pointer slice(Pointer existing, int capacity) {
   if ((existing.getEnd() - existing.getStart()) == capacity + 1 && existing.isFree()) {
     return existing;
   }
   Pointer fresh = new Pointer();
   fresh.setBlockNumber(existing.getBlockNumber());
   fresh.setStart(existing.getStart());
   fresh.setEnd(fresh.getStart() + capacity);
   fresh.setFree(true);
   fresh.setPrev(existing.getPrev());
   existing.setPrev(fresh);
   fresh.setNext(existing);
   existing.setStart(existing.getStart() + (capacity + 1));
   return fresh;
 }