[Javase] binary conversion (binary decimal hexadecimal octal)

Source: Internet
Author: User
Tags binary to decimal decimal to binary

Decimal to binary, in addition to 2 Operations

Decimal 6 to binary is (note from right to left to write, use a formula from bottom to top)

Binary to decimal, multiply by 2 procedure

Binary decimal 0*2 1 - Time Square of 0 Square +1*2 +1*2 's 2 - Time Square =6

Correspondence relationship

0 1 0 1 0 1

32 16 8 4 2 1

Add up the number of 1 corresponding positions, so it's

One byte 1 1 1 1 1 1 1 1 The maximum value is 255

Addition Operation 5 + 4=9, turning into binary operation

1 0 1

+1 0 0

1 0 0 1

Other binary conversions

Octal can be thought of as three bits for one person, for example: 0101 1010

0 0 1 0 1 1 0 1 0

1 3 2 so octal is the

Hexadecimal can be thought of as four bits for one person, for example:

0 1 0 1 1 0 1 0

5 A so hex is 5A

Negative binary binary

An integer account of Eight bytes, binary counter +1 binary

The highest digit of the negative number is 1 .

[Javase] binary conversion (binary decimal hexadecimal octal)

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.