js learning-hexadecimal conversion

  1. Decimal to binary:
    modulo two remainder, from bottom to top, fixed process 56----110100

    Convert decimal to binary first, then convert binary to octal or hexadecimal

  2. Binary to octal:
    Counting from right to left, every three digits in one group, and 0 to fill in less than three digits, and finally each group of digits is converted to decimal system separately

 110 1001*2^1 + 1*2^2 = 61*2^2=464  4*8^0 + 6*8^1 = 52
  1. Binary hexadecimal system:
    count from right to left, each group of four digits, fill in with 0 if there are less than four digits, and finally each group of digits is converted to decimal
   0011 0100
   34  4*16^0 + 3*16^1=52

Guess you like

Origin blog.csdn.net/qq_43812504/article/details/108391105