The method of converting positive integers into binary is "divide by 2, take the remainder, and arrange in reverse order".
Represents the binary representation of an integer, the first digit is the flag bit, 0 represents a positive integer, the number of digits Starting from the right, the first digit is 0, the number of digits in each digit is recorded as n, take the number of each digit (1 or 0)*2^n, and then add the operations of all digits to get Decimal.
Bitwise AND: operator &, the corresponding bits are all 1, and the result is is 1, otherwise 0, and the accuracy is consistent with the highest accuracy. The result of the bitwise AND operation will not be greater than the minimum value participating in the operation
Bitwise OR: operator |, the corresponding bits are all 0, and the result is 0 , otherwise it is 1, and the accuracy is consistent with the highest accuracy. The result of bitwise OR operation will not be less than the maximum value participating in the operation
Bitwise negation: operator ~, 1 is converted to 0, 0 is converted to 1 .
Bitwise XOR: operator ^, the corresponding bits are the same, the result is 0, otherwise it is 1, the precision is consistent with the highest precision.
Shift operation: y<
Bit operations are processed quickly.
The above is the detailed content of A brief description of java median operations. For more information, please follow other related articles on the PHP Chinese website!