docs: public void encode(final BitOutputStream out, final long value, final long max)
      throws IOException {
      if (0 == max) {
        return;
      }
      int bits = (int) (Math.round(log2(2 * this.stdDev)) - 1);
      if (0 > bits) {
        bits = 0;
      }
      final long centralWindow = 1l << bits;
      if (centralWindow >= (max + 1) / 2.) {
        out.writeBoundedLong(value, max + 1);
        return;
      }
      long stdDevWindowStart = (long) (this.mean - centralWindow / 2);
      long stdDevWindowEnd = stdDevWindowStart + centralWindow;
      if (stdDevWindowStart < 0) {
        stdDevWindowEnd += -stdDevWindowStart;
        stdDevWindowStart += -stdDevWindowStart;
      }
      else {
        final long delta = stdDevWindowEnd - (max + 1);
        if (delta > 0) {
          stdDevWindowStart -= delta;
          stdDevWindowEnd -= delta;
        }
      }
      if (value < stdDevWindowStart) {
        out.write(false);
        if (stdDevWindowEnd <= max) {
          out.write(false);
        }
        out.writeBoundedLong(value, stdDevWindowStart);
      }
      else if (value < stdDevWindowEnd) {
        out.write(true);
        out.writeBoundedLong(value - stdDevWindowStart, centralWindow);
      }
      else {
        out.write(false);
        if (stdDevWindowStart > 0) {
          out.write(true);
        }
        out.writeBoundedLong(value - stdDevWindowEnd, 1 + max - stdDevWindowEnd);
      }
    }