Java basic syntax (operation between bases)

For integers, there are usually four representations:

Binary: full two into one, starting with 0b or 0B

Decimal: full decimal one,

Octal: full eight into one, starting with 0

Hexadecimal: full 16, starting with 0x or 0X, AF is not case sensitive

 

 

The data is stored in two's complement form at the bottom layer

 

 

 

 

 

Original code, inverse code, complement code

All numbers are stored in two's complement form under the hood

The original, inverse, and complement of integers are the same

The complement of a negative number is the original code except the sign bit, and the other bits are inverted. The complement is the complement +1.

 

conversion between bases

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325340105&siteId=291194637