private void populateBytes() {
    Arrays.fill(internalBytes, (byte) 0);

    long seconds = timestampTZ.getEpochSecond();
    int nanos = timestampTZ.getNanos();

    boolean hasSecondVInt = seconds < 0 || seconds > Integer.MAX_VALUE;
    boolean hasDecimal = setNanosBytes(nanos, internalBytes, offset + 4, hasSecondVInt);

    int firstInt = (int) seconds;
    if (hasDecimal || hasSecondVInt) {
      firstInt |= DECIMAL_OR_SECOND_VINT_FLAG;
    }
    intToBytes(firstInt, internalBytes, offset);
    if (hasSecondVInt) {
      LazyBinaryUtils.writeVLongToByteArray(internalBytes,
          offset + 4 + WritableUtils.decodeVIntSize(internalBytes[offset + 4]),
          seconds >> 31);
    }
  }
The data of TimestampTZWritable can be stored either in a byte[]
or in a TimestampTZ object. Calling this method ensures that the byte[]
is populated from the TimestampTZ object if previously empty.
serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampLocalTZWritable.java