hex to bytes conversion

I'm reading the text below which says

The frame must include a sequence number of 2 bytes (Sequence Number = 0x0 to 0xFFFF} If I convert 0xFFFF to binary I get 0000 1111 1111 1111 1111.

Is this not more than 2 bytes?

Where did you do the convertion? Not in your head anyway. So let me ask you a question.

Is 0099 more then 2 digits to store?

transcendglue: If I convert 0xFFFF to binary I get 0000 1111 1111 1111 1111.

How do you convert? If you did it on paper, take a photo and post. Else please post the code (unless you did it in your head).

0x is not part of the number. It's the way you introduce a base 16 (hex) number in C/C++.

Hi,

I converted it using this website:

http://www.binaryhexconverter.com/hex-to-binary-converter

Sorry, if this a stupid question. Is there not 8 bits in a byte? and there is more than 16 bits in 0000 0000 1111 1111 1111 1111?

Thanks

Let me ask again, can you write 099 in two digits? How about 000099? And 00000000099?

Yes, I guess, it would be 99. Sorry I still don't get your point.

The leading 0's are nothing like you gasped with decimal. It's the same in binary, hexadecimal, octal or whatever. 0000 0000 1111 1111 is the same as 0000 1111 1111 is the same as 1111 1111. AS long as you don't want to go any further then that. So you can store all three in 2-byte.

That site does not have brains :)

0xffff gives 0000 0000 1111 1111 1111 1111 ffff gives 1111 1111 1111 1111

It translates the the 0 of 0x correctly to 0000 but it also translates the x in 0x to 0000. So you must not add the 0x when you enter a value.

Indeed brainless site, I use google most of the time https://www.google.com/search?q=0xffff+in+decimal

But okay, at least it turn a invallid hex into 0 instead of turning the x into a 1 (a "hex" x would be 33 = 0b100001 => 0b0001 if cropped to 4-bit).