You may or may not know that a computer stoures 0s and 1s. At hardware level, a 0 is represented by low voltage and a 1 is represented by higher voltage. Now then in our normal system, we can have numbers ranging from 0-9. A computer only understands 0-1.
In a binary number system, we will have many of these 0s or 1s. Each one of these number is known as a bit.
8 bit of these put together is called a byte.
The number system that you use in everyday life is called the decimal system. Some of you may notice that the decimal means that there are 10 (dec in latin is 10) possible combinations of each digit.
This is clear since we can have 0,1,2,3,4,5,6,7,8,9. In the binary system we are only allowed 2 combinations for each digit, 0 and 1.
Now then imagine when you're counting up in 19, yo go from 0 to 9, you know that there is nothing next so you put 1 on to the column next to it and reset the column that contained 9.
In binary, it is exactly the same, You start with 0, and go to a 1. You can now see that we can no longer represent further combinations with 1 bit so the next value would be 10.
Now how could we convert binary to a decimal?
, first of all, lets look again at a decimal number: 842
What does 842 mean? Well its possible for us to look at it like this. We can say the first column (hundreds)
represented how many lots of 1000 there are. Now we can also write 100 as 10^2 (10 squared). The next column along (tens) represents how many lof of 10 we have. The column can be re-written as 10^1 (10 to the power of one). The last column represents how many lofs of 1 we have. This can be re-written as 10^0 (10 to the power of zero), remember that anything to the power of 0 is 1. Therefor the value of
842 is
8*(10^2)+4(10^1)+2(10^0)
The binary system is exactly the same except our base is not 10, but rather 2.
Word - A word is 16 bits, or 2 bytes. Therefor we have 2^16 -1 different combination that is 65535.
Double word - A double word (also known as dword) is 32bits, 2 words or 4 bytes. Therefore we have 2^32 -1 different possible combinations, that is 4294967295.
Kilobyte - A measurement you might be little more familiar with. A kilobyte represents 1024 bytes.
Megabyte - 1024 kilobytes
Hexadecimal system
Hex = 6
Dec = 10
Hexadecimal = base 16
In hexadecimal number system, we have 16 different combinations for 1 digit: 0,1,2,3,4,5,6,7,8,9, A,B,C,D,E,F
0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15
This is just like before except we have a base 16 number, so lets say we are given the value 2C8A
we can convert it into our decimal system by lookin at it like this
2*(16^3)+12(16^2)+8*(16^1)+10*(16^0) = 11402