To get into field of any software engineering you must know a few number systems. You guessed it right; one of them is binary!

- Binary is a numeric system which uses two numerals to represent all real numbers.: typically 0 (zero) and 1 (one).
- Binary number systems are usually represented in octets, meaning that there are 8 binary numbers per octet for example: 00000000 or 10101011
- Binary is useful in resolving IP addresses, decoding decimal values and more.

- In the binary numbering system, the radix is 2. Therefore, each position represents increasing powers of 2. In 8-bit binary numbers, the positions represent these quantities:
- 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0 = 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1

- A 1 in a certain position means we add that value to the total. A 0 means we do not add that value. For example the binary number 0110000 has a 1 in the 2^6 position (decimal value 64) and a 1 in the 2^5 position (decimal value 32). The remaining bits are all 0 so we do not add the corresponding decimal values. The result of adding 32+64 is 96, the decimal equivalent of 01100000.

- Each octet is made up of 8 bits or 8 binary numbers and each bit has a value, either 0 or 1. The four groups of 8 bits have the same set of valid values in the range of 0 to 255 inclusive.

**Overview**

- If there is a 0 in a position, do not add the value.

- If all 8 bits are 0s, 00000000, the value of the octet is 0.

- If all 8 bits are 1s, 11111111, the value of the octet is 255 (128+64+32+16+8+4+2+1)

- If the 8 bits are mixed, the values are added together. For example, the octet 00100111 has a value of 39 (32+4+2+1)

## No comments:

## Post a Comment