Now imagine once again that we have 8 cables and there's current on every cable
so current on the first cable, second one and so forth and so on
each cable has current, that means that this value is 128, 64, 32, and so forth
If you add all those values together
so 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, you get a value of 255
Thus 8 binary 1s equals 255 in decimal, that's because each logical cable
is set on, in other words, it has a value of 1 and this value for example
represents 2 to the power of 5 which equals 32 in decimal
So adding all of those values together gives you a value of 255 in decimal
So let's demonstrate this using a Windows calculator
So in this example, I'm going to go to calculator and change it to programmer
This allows me to see both decimal and binary values
So 255 in decimal is equivalent to 8 binary 1s or once again
8 binary 1s is equivalent to 255 in decimal
255 in decimal is equivalent to 8 binary 1s
So here's another example, what is the binary equivalent of 1 in decimal?
So using our table, the decimal value is 1, that means that these values are
are all turned off, in other words, the binary equivalent is 0
for the first 7 values, but the last value is turned on
So 1 in decimal is equivalent to 7 binary 0s followed by binary 1
Once again using our Windows calculator
1 in decimal is equivalent to 1 in binary
but because we're using this mainly with IP Addressing you'll tend to write
it as follows, the Windows calculator removes the leading 0s
So 1 in decimal is equivalent to 1 in binary, in this example what is
equivalent binary value of 192 in decimal?
So using our table 192 is equivalent to 128 + 64 which implies that the
first bit is on and the second bit is on but the remaining bits are set to 0
128 + 64 = 192, thus, 11 followed by 6 binary 0s, is equivalent to 192 in decimal
using our Windows calculator once again, a 192 in decimal equals
11000000 in binary which is once again the equivalent of 192 in decimal
Here's another example, what is the binary equivalent of 253 in decimal?
Now 253 in decimal is a 128 + 64 + 32 + 16 + 8 + 4 + 1
and once again that gives you 253
So 128 means the first or most significant bit is set on
64 implies the second bit is on, 32 means that the third bit is on
16 means the fourth bit is on, 8 means the fifth bit is on
4 means the sixth bit is on and the 1 means that the last bit
or least significant bit is on, 2 is set off in this example
So 253 in decimal is equal to 6 binary 1s followed
by binary 0 followed by binary 1
So 253 equals 6 binary 1s followed by 0, followed by 1
So I am hoping at this point you have a good understanding on how to convert
decimal to binary and back again. There are many tricks with regards to
binary that can allow you to speed up the calculations
One example would be that 255 - 2 = 253, in other words, this value is set off
which allows you to work out that 255 looks like this but that bit is set off
so 253 looks like this