How to convert Decimals into Binary then into Hex
Posted: Sat Sep 09, 2006 11:17 am
Ok, This goes along with Cisco Networking.
And even though a calculator can do it in 0.00001 Seconds, it never hurts to learn.
Decimals are based off the power's of 2.
I.E
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
You stop at 128!
Its Really Quite Simple,
Heres How we go into Binary.
I give you the number 74.
Take your Powers.
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
And say can 128 (first number) fit into 74? NO So It Gets an "Off" = 0
so
128 = 0
64 = 1 (64 can fit into 74 so it gets a 1)
32 = 0 ( 64 + 32 = 96 (Over 74) so it gets an 0)
16 = 0 (64 + 16 = 80 (Over 74) so it also gets a 0)
8 = 1 (64 + 8 = 72 (Fits in) so it gets a 1)
4 = 0 (72 + 4 = 76 (to much) so it gets a 0)
2 = 1 (72 + 2 = 74 (Just right so it gets a 1)
1 = 0 (74 + 1 = 75 (to much) so it gets a 0)
So 74 is equal to 01001010 in binary.
Get it?
Now into Hex.
With the binary of 74 (01001010)
You Split it in half (2 groups of 4 characters) 0100-1010
In Hex you can only use 4 Digits of the powers of 2
So you can only use 8 - 4 - 2 - 1
0100-1010
0 (holds a 0 value so its nothing)
1 (holds a 4 value)
0 (holds nothing)
0 (holds nothing)
/
1 (holds an 8 value)
0 (hold a 0 value)
1 (holds a 2 value)
0 (holds a 0 value)
the first half is equal to 4 / the second half is equal to 10
so 0x4A
Oh and the A comes from
Hex is made by
0,1,2,3,4,5,6,7,8,9 AND
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15
(it stops there, there is no G-Z)
So because the second half was equal to 10, The ten was changed to an "A"
Understand?
So 74 Is 01001010 In Binary And 0x4A In Hex.
This Is Used In Cisco! I.E Networking. The Values Only Go Upto 255 (Highest IP possible)
Its Fun (Class)!
And even though a calculator can do it in 0.00001 Seconds, it never hurts to learn.
Decimals are based off the power's of 2.
I.E
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
You stop at 128!
Its Really Quite Simple,
Heres How we go into Binary.
I give you the number 74.
Take your Powers.
128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
And say can 128 (first number) fit into 74? NO So It Gets an "Off" = 0
so
128 = 0
64 = 1 (64 can fit into 74 so it gets a 1)
32 = 0 ( 64 + 32 = 96 (Over 74) so it gets an 0)
16 = 0 (64 + 16 = 80 (Over 74) so it also gets a 0)
8 = 1 (64 + 8 = 72 (Fits in) so it gets a 1)
4 = 0 (72 + 4 = 76 (to much) so it gets a 0)
2 = 1 (72 + 2 = 74 (Just right so it gets a 1)
1 = 0 (74 + 1 = 75 (to much) so it gets a 0)
So 74 is equal to 01001010 in binary.
Get it?
Now into Hex.
With the binary of 74 (01001010)
You Split it in half (2 groups of 4 characters) 0100-1010
In Hex you can only use 4 Digits of the powers of 2
So you can only use 8 - 4 - 2 - 1
0100-1010
0 (holds a 0 value so its nothing)
1 (holds a 4 value)
0 (holds nothing)
0 (holds nothing)
/
1 (holds an 8 value)
0 (hold a 0 value)
1 (holds a 2 value)
0 (holds a 0 value)
the first half is equal to 4 / the second half is equal to 10
so 0x4A
Oh and the A comes from
Hex is made by
0,1,2,3,4,5,6,7,8,9 AND
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15
(it stops there, there is no G-Z)
So because the second half was equal to 10, The ten was changed to an "A"
Understand?
So 74 Is 01001010 In Binary And 0x4A In Hex.
This Is Used In Cisco! I.E Networking. The Values Only Go Upto 255 (Highest IP possible)
Its Fun (Class)!