Specify the conversion between the decimal number and the 8-bit binary number

Source: Internet
Author: User
You must be able to convert the decimal number within 255 to the corresponding binary number. You can refer to this formula table (the first row is binary, and the second row is decimal ):

1 1 1 1 1 1 1 1

128 64 32 16 8 4 2 1

You can see:

The first binary 1 from the left of the first line corresponds to 128 in decimal format.

The first line starts from the left and the second 1 corresponds to 64 in decimal format... and so on.

The above relationships must be kept in mind. This is the basis of hexadecimal conversion!

For example, to convert the decimal 133 to binary, you can think like this: Because 133 and 128 are relatively close, and because the first binary 1 from the left in the formula table represents 128, so we can immediately determine the leftmost bit of the binary to be converted into an 8-bit binary, and set it to 1. Next, we can see that there is only a difference of 5 between 133 and 128, while 5 is the sum of 4 and 1, and 4 and 1 correspond to the 6th and 8th bits on the left of the formula table, respectively, therefore, to convert decimal 133 to an 8-bit binary value, it is 10000101, corresponding to the following:

1 0 0 0 0 1 0 1 (Binary 133)

128 0 0 0 0 4 0 1 (decimal 133)

The other decimal number less than 255 is converted into an 8-bit binary number.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.