LittleEndian Method
3212 // 10 = 321 3212/ 10 = 321 r 2 341 *1 170 *01 85 *101 42 *0101 21 *10101 10 *010101 5 *1010101 2 *01010101 1 *101010101 0 101010101 1000 BigEnd: 1 4 0 6 4 4 36 3 28 216 4 136 1296 0 1000 Read UP: 1000 = 43446 1000 *4 166 *44 27 *344 4 *4344 0 4344
For Any Base
BigEndian Method
LittleEndian Method
Octal and Hexadecimal Numbers
Octal numbers are base 8, and hexadecimal is base 16.
0b10111010101011101 10 111 010 101 011 101 2 7 2 5 3 5 0o272535 (packing) Unpacking: 0o53325 10101101101010 base 16 alphabet = {0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F} 1 0101 0101 0101 0110 1010 1010 1 5 5 5 6 A A → 0x15556AA Unpacking 0xff567 f f 5 6 7 1111 1111 0101 0110 0111 0b11111111010101100111Everything is Bits!
This is an illusion. We will learn about the reality.
abcdefghijklnnopqrstuvwxyz ABCDEFGHIJKLNNOPQRSTUVWXYZ 0123456789!@#$%^&*()_-+=<>
First, we do a hex dump.
0000000: 6162 6364 6566 6768 696a 6b6c 6e6e 6f70 abcdefghijklnnop 0000010: 7172 7374 7576 7778 797a 0a41 4243 4445 qrstuvwxyz.ABCDE 0000020: 4647 4849 4a4b 4c4e 4e4f 5051 5253 5455 FGHIJKLNNOPQRSTU 0000030: 5657 5859 5a0a 3031 3233 3435 3637 3839 VWXYZ.0123456789 0000040: 2140 2324 255e 262a 2829 5f2d 2b3d 3c3e !@#$%^&*()_-+=<> 0000050: 0a .The first colum contains the first byte number for each line, starting at 0. The second line begins with byte 0x10 = 16.
In the middle, the bye values for each character are shown. At the end of the line the characters are displayed.
The character
a
has byte value 0x61 = 97. The characterb
has byte value 0x62 = 98. The characterc
has byte value 0x63 = 99.The byte values for the lower-case letters are encoded in seriatum. The upper-case letters being wth
A
at 0x41 = 65. Each upper case letter hs a byte values 32 lower than its lower-case counterpart. This means they only differ in the 32s bit. Now lets see the bits in the file. Here is a binary dump of the file0000000: 01100001 01100010 01100011 01100100 01100101 01100110 abcdef 0000006: 01100111 01101000 01101001 01101010 01101011 01101100 ghijkl 000000c: 01101110 01101110 01101111 01110000 01110001 01110010 nnopqr 0000012: 01110011 01110100 01110101 01110110 01110111 01111000 stuvwx 0000018: 01111001 01111010 00001010 01000001 01000010 01000011 yz.ABC 000001e: 01000100 01000101 01000110 01000111 01001000 01001001 DEFGHI 0000024: 01001010 01001011 01001100 01001110 01001110 01001111 JKLNNO 000002a: 01010000 01010001 01010010 01010011 01010100 01010101 PQRSTU 0000030: 01010110 01010111 01011000 01011001 01011010 00001010 VWXYZ. 0000036: 00110000 00110001 00110010 00110011 00110100 00110101 012345 000003c: 00110110 00110111 00111000 00111001 00100001 01000000 6789!@ 0000042: 00100011 00100100 00100101 01011110 00100110 00101010 #$%^&* 0000048: 00101000 00101001 01011111 00101101 00101011 00111101 ()_-+= 000004e: 00111100 00111110 00001010 <>.Observe that the character
0
has byte value 0x30 = 48.Now see what the computer sees.
01100001011000100110001101100100011001010110011001100111011010000110100 10110101001101011011011000110111001101110011011110111000001110001011100 10011100110111010001110101011101100111011101111000011110010111101000001 01001000001010000100100001101000100010001010100011001000111010010000100 10010100101001001011010011000100111001001110010011110101000001010001010 10010010100110101010001010101010101100101011101011000010110010101101000 00101000110000001100010011001000110011001101000011010100110110001101110 01110000011100100100001010000000010001100100100001001010101111000100110 00101010001010000010100101011111001011010010101100111101001111000011111 00000101011111111If you are observant, you will see I added a final byte: 11111111; this is the end of file byte.
Color
Color is stored in 24 bits. The first byte is red, the second is green, and the third is blue. Use the JavaScript app to type in six-digit hex code and see their colors. A fourth byte is devoted to alpha, or transparence. Even colors are just ... bits.