private static int paddingRecordHeader(int lengthToPad) {
      if (lengthToPad == 0) {
        throw new IllegalArgumentException("lengthToPad(=" + lengthToPad + ") must be >0");
      }
      int totalRecordSize = lengthToPad;
      if ((totalRecordSize & (~RECORD_LENGTH_MASK)) != 0) {
        throw new IllegalArgumentException("lengthToPad(=" + lengthToPad + ") must have 2 highest bits 0");
      }

      //padding record has no content => immediately committed:
      return totalRecordSize | RECORD_TYPE_MASK | COMMITED_STATUS_OK;
    }
private static int paddingRecordHeader(int lengthToPad)