Home > Java > javaTutorial > A brief description of java median operations

A brief description of java median operations

巴扎黑
Release: 2017-07-22 14:07:11
Original
1288 people have browsed it

1. Convert decimal to binary

The method of converting positive integers into binary is "divide by 2, take the remainder, and arrange in reverse order".

2. Convert binary to decimal

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.

3. Bit operations

  • 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<n, y>>n is equivalent to y/2 n. Because bit operations execute quickly, bit operations can be used when dividing or multiplying by 2n in Java code.

4. The value of bit operations

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template