what is a byte ?
A byte is 8 bits ,
[_ _ _ _ _ _ _ _ ] 7 6 5 4 3 2 1 0 number of bits = 7 - 0 + 1 = 8
A bit can have a value of 1 or 0 .
The min value of a byte is when all the bits are 0 :
and it is equal to zero.
The max value of a byte is when all the bits are equal to 1 .
and it is 255.
Byte representation in decimal
A byte is 8 bits , and it is represented in binary . We can convert it to decimal by multiplying each bit by two to the power of the position of this bit , and summing the result . The min value of a byte in decimal is 0 , and its max value is 255 .
Byte representation in hexadecimal : base 16
Instead of writing a byte using its binary representation , we can write a byte using its hexadecimal representation . In hexadecimal , each 4 bits are grouped into one character , which can be between [0-F]
Hence we can write a byte by using only two hexadecimal [ 0- F] characters .
Byte representation in octal : base 8
We can also write a byte by using the octal notation . In octal , each 3 bits are grouped into one character , which can be between [0-7] .
A byte is formed of 8 bits . This means , that we must use 3 octal [0-7] digits , to represent a byte . The leading octal digit must have a max value of 3.
[ byte : 8 bits , represented : binary , decimal , octal , hexadecimal min : 00000000 , 0 , 000 , 00 max : 11111111 , 255 , 377 , FF ]