Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. A2B hex to bin (dec after, optionally). First, remember that hex numbers are easier to handle in groups of pairs. So let's turn A2B into:
  2.  
  3. 0A 2B
  4.  
  5. We can then convert each one seaparately, to make life easier. First, let's do 2B. Since 2 hex digits make up 1 byte (just memorize this), we know there are 8 bits in binary for 2 hex digits. Or 4 bits per each hex digit. Then convert each ditit into decimal in your head (remember 0-9 in hex is 0-9 in decimal, then they go A=10, B=11, C=12, D=13, E=14, F=15, so in total you have 16 different digits... hence "hex"). Since 2 in hex is 2 in dec, it's easy.. we can just convert it to binary (you know how) = 0010. B is a bit harder, though:
  6.  
  7. xxxx xxxx
  8. 0010 ???? B = 11 (cause 10 is A, so B is 11) 11 dec in bin is?
  9. 0010 1011
  10.  
  11. 0A?
  12.  
  13. xxxx xxxx
  14. 0000 ???? A = 10, so..
  15. 0000 1010
  16.  
  17. So 0A2B hex in bin is:
  18. 00001010 00101011
  19.  
  20. then you can convert this to decimal the usual way:
  21. remember, you can just build the table bigger for longer numbers
  22. 1 2 4 8 16 32 64 128 256 512 1024 2048 (think RAM bytes)
  23.  
  24. 2048 + 0 + 512 + 0 + 0 + 0 + 32 + 0 + 8 + 0 + 2 + 1 = 2603
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement