code: void writeExternal(DataOutput out) throws IOException {
          final int timeSecs = time.toSecondOfDay() + adjustDays * SECS_PER_DAY;
          final int stdOffset = standardOffset.getTotalSeconds();
          final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset;
          final int afterDiff = offsetAfter.getTotalSeconds() - stdOffset;
          final int timeByte = (timeSecs % 3600 == 0 && timeSecs <= SECS_PER_DAY ?
                  (timeSecs == SECS_PER_DAY ? 24 : time.getHour()) : 31);
          final int stdOffsetByte = (stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255);
          final int beforeByte = (beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
          final int afterByte = (afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3);
          final int dowByte = (dow == null ? 0 : dow.getValue());
          int b = (month.getValue() << 28) +          // 4 bits
                  ((dom + 32) << 22) +                // 6 bits
                  (dowByte << 19) +                   // 3 bits
                  (timeByte << 14) +                  // 5 bits
                  (timeDefinition.ordinal() << 12) +  // 2 bits
                  (stdOffsetByte << 4) +              // 8 bits
                  (beforeByte << 2) +                 // 2 bits
                  afterByte;                          // 2 bits
          out.writeInt(b);
          if (timeByte == 31) {
              out.writeInt(timeSecs);
          }
          if (stdOffsetByte == 255) {
              out.writeInt(stdOffset);
          }
          if (beforeByte == 3) {
              out.writeInt(offsetBefore.getTotalSeconds());
          }
          if (afterByte == 3) {
              out.writeInt(offsetAfter.getTotalSeconds());
          }
      }
docs: Writes the state to the stream.
  
  @param out  the output stream, not null
  @throws IOException if an error occurs