docs: public static void writeLongSequence(long hd, long hr, DataOutput out) throws IOException {
          if(hr < hd)
              throw new IllegalArgumentException("hr (" + hr + ") has to be >= hd (" + hd + ")");
  
          if(hd == 0 && hr == 0) {
              out.write(0);
              return;
          }
  
          long delta=hr - hd;
  
          // encode highest_delivered followed by delta
          byte bytes_for_hd=bytesRequiredFor(hd), bytes_for_delta=bytesRequiredFor(delta);
          byte bytes_needed=encodeLength(bytes_for_hd, bytes_for_delta);
          out.write(bytes_needed);
  
          for(int i=0; i < bytes_for_hd; i++)
              out.write(getByteAt(hd, i));
  
          for(int i=0; i < bytes_for_delta; i++)
              out.write(getByteAt(delta, i));
      }