1. Binary
The binary is a notation that can represent all values with a finite number symbol. is made up of specific values.
2. The representation of the binary
Binary: consists of 0 and 12 digits.
Octal: Consists of 0-7 numbers, in order to differentiate it from the other binary numbers, beginning with 0.
Decimal: All are made up of 0-9 of these nine digits and cannot start with 0.
Hex: Consists of 0-9 and a-f. To differentiate between other numbers, start with 0x or 0X.
3. Conversion between the binaries
3.1 Decimal to binary: Divide by 2, reverse the remainder until the quotient is 0. (Integer.tobinarystring (9))
3.2 Binary to decimal: each number of binary times is multiplied by 2 N, n indicates the position of the current number starts at 0 and increments by 1 each time. Then each number that comes out is added.
3.3 Decimal to 8 binary: divide by 8, reverse the remainder until the quotient is 0.
3.4 Octal to decimal: Each number is multiplied by 8 N, n indicates the position of the current number starts at 0 and increments by 1 each time. Then each number that comes out is added.
3.5 Decimal to 16 binary: Divide by 16, reverse the remainder until the quotient is 0. Hexadecimal features: 0~9 A (Ten) B (one) c (+) d (+) e (15).
Hexadecimal to decimal: Each number is multiplied by 10 N, n indicates that the current number is in the position starting at 0 and increments by 1 each time. Then each number that comes out is added.
Binary, octal, decimal, hexadecimal in Java