code: public T remove(boolean nullify) {
          long tmp=hd+1;
          if(tmp > hr.get())
              return null;
          int index=index(tmp);
          T element=buf.get(index);
          if(element == null)
              return null;
          hd=tmp;
  
          if(nullify) {
              long tmp_low=low;
              if(tmp == tmp_low +1)
                  buf.compareAndSet(index, element, null);
              else {
                  int from=index(tmp_low+1), length=(int)(tmp - tmp_low), capacity=capacity();
                  for(int i=from; i < from+length; i++) {
                      index=i & (capacity - 1);
                      buf.set(index, null);
                  }
              }
              low=tmp;
              lock.lock();
              try {
                  buffer_full.signalAll();
              }
              finally {
                  lock.unlock();
              }
          }
          return element;
      }
docs: Removes the next element (at hd +1). <em>Note that this method is not concurrent, as
  RingBuffer can only have 1 remover thread active at any time !</em>
  @param nullify Nulls the element in the array if true
  @return T if there was a non-null element at position hd +1, or null if the element at hd+1 was null, or
  hd+1 > hr.