public void setBinarySortable(byte[] bytes, int binSortOffset) {
    // Flip the sign bit (and unused bits of the high-order byte) of the seven-byte long back.
    long seconds = readSevenByteLong(bytes, binSortOffset) ^ SEVEN_BYTE_LONG_SIGN_FLIP;
    int nanos = bytesToInt(bytes, binSortOffset + 7);
    int firstInt = (int) seconds;
    boolean hasSecondVInt = seconds < 0 || seconds > Integer.MAX_VALUE;
    if (nanos != 0 || hasSecondVInt) {
      firstInt |= DECIMAL_OR_SECOND_VINT_FLAG;
    } else {
      firstInt &= LOWEST_31_BITS_OF_SEC_MASK;
    }

    intToBytes(firstInt, internalBytes, 0);
    setNanosBytes(nanos, internalBytes, 4, hasSecondVInt);
    if (hasSecondVInt) {
      LazyBinaryUtils.writeVLongToByteArray(internalBytes,
          4 + WritableUtils.decodeVIntSize(internalBytes[4]),
          seconds >> 31);
    }

    currentBytes = internalBytes;
    this.offset = 0;
  }
Given a byte[] that has binary sortable data, initialize the internal
structures to hold that data
@param bytes the byte array that holds the binary sortable representation
@param binSortOffset offset of the binary-sortable representation within the buffer.
serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampWritableV2.java