So
here's normal, base1 counting on your fingers. In base 1, you
just raise the number of fingers equal to the value you're trying to
represent:


This is funky base2 counting on your fingers. Each finger represents a
different value now, so you have to start counting with '1' at your
pinky, then '2' with just your ring finger, and '3=2+1' is pinky and
ring finger together. '4' is a single raised middle finger. Then
'5=4+1' is middle finger and pinky, and so on. Just 10 digits actually
allows you to count all the way to 1023, but we'll ignore the thumbs
and just use 8 fingers, to count up to 255=128+64+32+16 (left hand
palmup, pinky is 16) +8+4+2+1 (right hand palmdown, pinky is 1).
This is actually somewhat useful for countingtry it! (Note: the numbers four, sixtyfour, and especially sixtyeight should not be prominently displayed. Digital binary counting is not recommended in a ganginfested area.) 
long x=1024;Why? The real answer is 4 billion (and change), which requires 33 bits: a 1 followed by 32 zero bits. But on a 32bit machine, all you get is the zeros; the higher bits "overflow" and (at least in C/C++) are lost! Understanding the bits underneath your familiar integers can help you understand errors like this one. (Plus, by writing assembly code, you can actually recover the highorder bits after a multiplication if you need them.)
long y=x*x*x*4;
return y;
Place/bit Number  i  ...  4  3  2  1  0 
Decimal: Base10 
10^{i} 
... 
10000 
1000 
100 
10 
1 
Binary: Base2 
2^{i}  ... 
16 = 2^{4} 
8 = 2^{3} 
4 = 2^{2} 
2 
1 
Octal: Base8 
8^{i} 
... 
4096=8^{4}  512=8^{3}  64=8^{2}  8 
1 
Hex: Base16 
16^{i}  ... 
65536 = 2 
4096 = 16^{3}  256 = 16^{2} 
16 
1 
Basen 
n^{i}  ... 
n^{4} 
n^{3}  n^{2}  n 
1 = n^{0} 
Decimal 
Hex  Binary 
0 
0  0 
1 
1  1 
2 
2  10 
3 
3  11 
4 
4  100 
5 
5  101 
6 
6  110 
7 
7  111 
8 
8  1000 
9 
9  1001 
10 
A  1010 
11 
B  1011 
12 
C  1100 
13 
D  1101 
14 
E  1110 
15 
F  1111 
16 
10 
10000 
Hex PlaceValue 
16^{3} 
16^{2} 
16 
1=16^{0} 

Hex Digit 
F 
0 
3 
6 

Binary Digit 
1 
1 
1 
1 
0 
0 
0 
0 
0 
0 
1 
1 
0 
1 
1 
0 
Binary PlaceValue 
2^{15} 
2^{14} 
2^{13} 
2^{12} 
2^{11} 
2^{10} 
2^{9} 
2^{8} 
2^{7} 
2^{6} 
2^{5} 
2^{4} 
2^{3} 
2^{2} 
2^{1} 
2^{0} 
804a516: 80 fa 3f cmp dl,0x3fNote that every single number is listed in hexthe addresses, on the left; the machine code, in the middle; and the constants in the assembly, on the right. A binary file display tool is called a "hex dump". A binary file editor is called a "hex editor". That's how common hex is, so for the rest of the class to make sense, you've gotta learn it!
804a519: 0f 84 7c 01 00 00 je 804a69b <exit@plt+0xc2b>