# Learn and practice binary and hexadecimal numbers

This topic is 4948 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Over my years of learning programming, ive learned that binary and hexadecimal numbers are very important. I have learned each maybe once or twice but not enough to truly remember them. I am looking for a quality tutorial that you would recommend as a way to learn and practice binary/hex numbers. Thank you :)

##### Share on other sites
They work the same way "normal" base 10 numbers work.

If you want to set a given bit, use the left shift operator, and shift 1 to the left enough times, using bitwise or to set more than one bit.

To convert from decimal to dex or binary, use the windows calculator (or, alternatively, create your own small program... base changing is extremely easy).

##### Share on other sites
Alright. I forgot that this should go into the Math forum...

##### Share on other sites
Do you basically understand how they work?

There's no question of practicing them. They come up useful in a lot of situations, and after encountering those situations over and over, you just get used to them.

One useful thing to know -- every hex digit is 4 binary digits. This makes converting from hex to binary very easy/

##### Share on other sites
One of the more important things to realize is that each hex number is four bits. Memorizing hex 1-F is important.

##### Share on other sites
It's been a couple of years since I've done this, so I might be a little off, but to do it by hand you need to use the Euclidian algorithm. I'm sure if mathworld or a similar math website could show you the inner workings of the algorithm.

##### Share on other sites
As a sidenote, today in class I was doing a history assignment for "Chaper 11" and thought, we just did chapter ten, why are we going back to three? Then I laughed at myself and only I knew what was so funny.

Anyway, to actually kind of contribute, knowing them comes in handy. Understanding how they represent the underlying data is vital. Its good to understand that the system we count with is similar to words in that, no matter you call them, they still represent the same thing. When you are dealing with data in RAM for example, four bytes could hold 0xBAADF00D, 3131961357, or 1011 1010 1010 1101 1111 0000 0000 1101 . Those charactors are simply a system that is used to represent the data that is there.

Hopefully that made some sence... I think I tried to get way to deep just then...

Dwiel

##### Share on other sites
Quote:
 Original post by Tazzel3DAs a sidenote, today in class I was doing a history assignment for "Chaper 11" and thought, we just did chapter ten, why are we going back to three? Then I laughed at myself and only I knew what was so funny.

Nerd!! Just kidding [grin] I think that's funny as well.

##### Share on other sites
8-bit binary number: 11010101                     ||||||||           27 (128) -+|||||||           26 (64)  --+||||||           25 (32)  ---+|||||           24 (16)  ----+||||           23 (8)   -----+|||           22 (4)   ------+||           21 (2)   -------+|           20 (1)   --------+decimal number: 128 + 64 + 16 + 4 + 1 = 213
It's not difficult to convert binary to decimal at all, and after a while you can do it in your head.

Every 4-bit group represents 1 hex digit.
0000 - 00001 - 10010 - 20011 - 30100 - 40101 - 50110 - 60111 - 71000 - 81001 - 91010 - A (10)1011 - B (11)1100 - C (12)1101 - D (13)1110 - E (14)1111 - F (15)
So in the binary -> decimal example, 11010101, or 213, would be D5 in hex.

##### Share on other sites
I have binary numbers down pretty good now. I read John Selvia's tutorials on counting binary numbers on your fingers and it helps a lot in converting back and forth very quickly :) (but only up to 1023)

• 36
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631359
• Total Posts
2999539
×