For people like me who start googling before reading Javadoc, here is Javadoc;)
UUID.toString
For those who do not know how to read the grammar tree, read from bottom to top.
hexDigit is one character
hexOctet is 2 hexDigits = 2 characters
node 6 * hexOctet = 6 * 2hexdigit = 6 * 2 characters = 12 characters
_and_sequence option : 2 * hexOctet = 2 * 2hexdigit = 2 * 2 characters = 4 characters
time_high_and_version - 2 * hexOctet = 2 * 2hexdigit = 2 * 2 characters = 4 characters
time_mid is 2 * hexOctet = 2 * 2hexdigit = 2 * 2 characters = 4 characters
time_low - 4 * hexOctet = 4 * 2hexdigit = 4 * 2 characters = 8 characters
and finally, the UUID is <time_low> "-" <time_mid> "-" <time_high_and_version> "-" <variable_and_sequence> "-" <node>
= 8 characters + 1 character + 4 characters + 1 character + 4 characters + 1 character + 4 characters + 1 character + 12 characters
= 36 characters! 128 data bits + 4 hyphens as previously indicated
The UUID string representation is as described by this BNF: UUID = <time_low> "-" <time_mid> "-" <time_high_and_version> "-" <variant_and_sequence> "-" <node> time_low = 4*<hexOctet> time_mid = 2*<hexOctet> time_high_and_version = 2*<hexOctet> variant_and_sequence = 2*<hexOctet> node = 6*<hexOctet> hexOctet = <hexDigit><hexDigit> hexDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "A" | "B" | "C" | "D" | "E" | "F"
user43968
source share