# What is a byte?

## ðŸ¥ª Summary

• A “Byte” is a grouping of 8bits“.
• Some counts start at zero.
• Set of Eight = { 0, 1, 2, 3, 4, 5, 6, 7 }
• A grouping of 8 is known as an ðŸ¦‘ octet.
• 8 bits can represent number sets { 0 … 255 } and { (-128) … 127 }.
• ASCII Encoding is an interpretation of the number set { 0 … 255 }.
• Bit groupings are known as blocks.
• Endianness is interpretation, most to least significant bit, or least to most significant bit, either big-endian or little-endian.

## A Byte

A byte is 8 bits, or an ‘octave’ or ‘octal‘ grouping of bits.

When all you have to work with are two switches that are either on or off, the best you can do is to group them.

 Bit Groupings 4-bits Â½ Byte / Nibble / Half Octet 8-bits Byte / Octet

## Start At Zero

In computer science, we sometimes consider zero ‘0’ to be the first item of any grouping.

Three Sets of Three
{ 0, 1, 2 },Â  { A, B, C },Â  { Î±, Î², Î³ }

 Four Different Numbering Systems Binary 27 26 25 24 23 22 21 20 Â { 0, 1 } 0 1 1 0 1 1 1 1 Octal 87 86 85 84 83 82 81 80 Â { 0 … 7 } 1 5 7 Decimal 107 106 105 104 103 102 101 100 Â { 0 … 9 } 1 1 1 Hexadecimal 167 166 165 164 163 162 161 160 Â { 0 … 9, A … F } 6 F

## ASCII Encoding

ASCII Encoding is based on the number set defined by groupings of eight bits, and we can interpret the grouping above as the letter “o”.

 Base II Base VIII Base X Base XVI ASCII 01101110 156 110 6E n 01101111 157 111 6F o 01110000 158 112 70 p

## Grouping Limits

Binary uses only two digits, 0, and 1, to represent certain sets of numbers. The sets are limited by the number of bits the system was designed to accomodate.

An 8-bit system, or a system that has 8-bit architecture, can accomodate numbers between 0 and 255.

8-bits = { 0 … 255 }

If you wanted to use one bit as a sign to distinguish between negative and positive integers, the range would change to -128 to +127.

8-bits signed = { (-128) … 127 }

Â Â Â Â Â Â 12710

Signed and Unsigned
Unsigned 0 0 0 0 0 0 0 0 2
0 10
1 1 1 1 1 1 1 1 2
2 5 5 10

There are three methods of representing negative numbers in binary. The first and most plain is to use one bit as an indicator of signage. If the bit is 1, the number may be positive. If the bit is 0, the number may be negative, or vise-versa.

Two more methods include 1s Compliment, and 2s Compliment.

1s Compliment

Invert the digits, as in 1s go to 0, and 0s go to 1. Use the leading bit to indicate singage, then flip the remaining digits back to decipher the positive or negative value. This method is used with the bitwise operator ^.

2s Compliment

Flip the bits as in 1s compliment, this time adding a value of one to the flipped value.

These groupings of bits are known also as blocks. Every byte of the system belongs to a specific, numbered block. These numbers are commonly referred to as “pointers”.

Pointers are numbered bytes. Pointers are usually represented as hexadecimal numbers, as byte quantities can become very large.

0x00000000 is the very first element of a 32-bit number space, in this case represented as a hexadecimal digit. The “0x” preceeding the alphanumeric sequence denotes that this is hexidecimal notation.

0xFFFFFFFF is the last element of the 32-bit number space.
4,294,967,295 individual bytes.
34,359,738,360 individual bits.

## Endianness

Endianness is another distinction between systems. It refers to the idea of which direction the information is read/written to, ie. left to right, right to left, front to back, back to front, most significant bit to least significant bit, least to most; A binary choice the systems designer must make in the early stages.

The two methods are known and big-endian, from most to least significant bit, and little-endian, least to most significant bit.

The least significant bit is analogous to the right-most integer in base 10 notation, in the style of the Western conventions.

The least significant bit is that which distinguishes the value as being either even or odd.

 Endianness Big-Endian x7 x6 x5 x4 x3 x2 x1 x0 Little-Endian x0 x1 x2 x3 x4 x5 x6 x7