-
Here's how to convert binary to hexadecimal:
1. Take the binary number.
2. Divide the binary numbers into four groups (starting from the right) as the integer part and starting from the left as the decimal part.
3. Group four numbers into a group and convert each group into the corresponding hexadecimal number.
4. This is a simple algorithm, but it requires grouping binary numbers and replacing them with hexadecimal numbers equivalent to them.
Binary is a system of numbers that is widely used in computing technology. Binary data is a number represented by two numbers, 0 and 1. Its cardinal number is 2, the carry rule is "every two into one", and the borrowing rule is "borrow one to become two", which was discovered by Leibniz, a German master of mathematical philosophy in the 18th century.
Current computer systems use basically binary systems, and data is stored in computers mainly in the form of complements. Binary in a computer is a very tiny switch, with 1 for "on" and 0 for "off".
The hexadecimal system (abbreviated as hex or subscript 16) is a 16-in-1 carry system in mathematics. It is generally represented by the numbers 0 to 9 and the letters A to F (or A-F), where A-F means 10-15.
The hexadecimal system is commonly used in computer science because it is not too difficult to convert 4 bits into individual hexadecimal numbers. One byte can represent two consecutive hexadecimal numbers, but this mixed notation is confusing, so it requires some initials, endings, or subscripts to distinguish them.
-
The conversion method from binary to hexadecimal is as follows: every 4 binary digits from right to left are added by weight to get the hexadecimal number.
Group binary numbers every four digits from right to left, and fill in with 0 on the left if there are fewer than four digits. Then convert each four-digit binary number to the corresponding hexadecimal number.
How to use hexadecimal:
1. Hexadecimal is a representation of data in a computer. It's not the same as the decimal notation we use in our daily lives.
2. The base number of the hexadecimal number is 16, and the numbers used are , a, b, c, d, e, f. Where a-f respectively represent the decimal number and the technical rule of the hexadecimal number is "every sixteen into one", and its rights are identified by the nth power of 16. Normally, the representation of a hexadecimal number can be marked with 16 or h in the lower right corner of the number, but in C language, the number is preceded by the number 0 and the letter x, i.e. 0x.
3. The rules for the addition and subtraction of hexadecimal numbers are: borrow one when sixteen, and enter one every sixteen. Hexadecimal numbers, like binary numbers and decimal numbers, can also be written in the form of formulas. <>
-
To convert a hexadecimal number to a binary number, as long as each hexadecimal number is represented by a four-digit corresponding binary number, the four-in-one method is taken. The hexadecimal system is every 16 into 1, and each bit can be from small to large as, a, b, c, d, e, f, a total of 16 numbers of different sizes.
From the decimal point of binary as the dividing point, every four digits to the left (to the right) are taken into one place, and then the four binary digits are added according to the weight, and the resulting number is a sixteen-digit binary number. Then, in order, the decimal point remains the same, and the resulting number is the hexadecimal number we are looking for.
If you take four digits to the left (right) and take the highest (lowest) digit, if the anterior fissure cannot make up four digits, you can add 0 to the leftmost (rightmost) decimal point, that is, the highest (lowest digit) of the integer, to make up four digits.
Convert decimal to binary:
The conversion of a decimal number to a binary source number is divided into integer parts and decimal parts, and finally combined together.
The integer part is divided by 2 and the remainder is arranged in reverse order. The specific method is: divide the decimal integer by 2 to get a quotient and remainder; Removing the quotient with 2 again gives you a quotient and remainder.
This is done until the quotient is less than 1, and then the remainder obtained first is used as the lower significant digit of the binary number, and the remainder obtained later is used as the high significant digit of the binary number, and the wisdom is arranged in turn. <>
-
The specific method of converting binary to hexadecimal is as follows.
1. First of all, let's take a look at the sixteen-digit representation. (as shown in the image below).
2. Table of correspondence between binary numbers and hexadecimal numbers. (as shown in the image below).
3. The method of converting binary to hexadecimal is to take the four-in-one method of rock yearling, that is, from the decimal point of binary as the demarcation point, and take every four digits to the left (or right) as one. (as shown in the image below).
4. After the components are good, compare the corresponding table of binary and hexadecimal numbers, add the four-digit binary according to the weight, and the number obtained is a one-digit hexadecimal number, and then arrange it in order, the position of the decimal point remains unchanged, and the last thing you get is the hexadecimal number. (as shown in the image below).
Binary to Hexadecimal Algorithm:
The binary carry rule is every two into one, and the borrowing rule is to borrow one as two. Binary to hexadecimal, just combine the binary number from right to left every four digits, and each early combination is represented by a hexadecimal number, note that the number of digits is insufficient to make up 0.
Count how many numbers there are in this string and divide them in groups of four from right to left. Hexadecimal is taken as a four-in-one, that is, from the decimal point of binary as the dividing point, every four digits to the left or right are taken into one place. As long as you divide the group, the weight of the four numbers in each group is 8421.
If the first digit is 1, add an 8, add a 4 if the second digit is 1, and so on.
Binary to Hexadecimal Notes:
When there is a decimal point, note that the position of the decimal point does not change.
If the last group is less than four digits, those who are not familiar with the corresponding table can add 0 to supplement. <>