public long timestamp() {
    if (version() != 1) {
      throw new UnsupportedOperationException("Not a time-based UUID");
    }
    long result = timestamp;
    if (result < 0) {
      result = (mostSigBits & 0x0000000000000FFFL) << 48;
      result |= ((mostSigBits >> 16) & 0xFFFFL) << 32;
      result |= mostSigBits >>> 32;
      timestamp = result;
    }
    return result;
  }