Bitwise operations in Java
Java bit operator
Bitwise operators are used to operate binary bits. Java provides bitwise operators as shown below:
Bitwise operator (>>,>>,&, |, ^ ,~ ), In the bitwise operator, ~ The others are binary operators. The
[Java Basics] 14. bitwise operations-bitwise AND (&) operations-(fast modulo algorithm) and java Basics 14 Operations
The redis dictionary structure is learned. The hash Value & sizemask operation is used when the hash is used to find the index
Before you understand the displacement, look at the binary representations and relationships of positive and negative numbers:Example 15 and-15:15 The original code: 00000000 00000000 00000000 00001111Complement: 11111111 11111111 11111111 11110000+1
http://aokunsang.iteye.com/blog/615658Prelude:Yesterday a buddy asked me Java displacement you will, I said no, think about displacement so troublesome, generally have displacement Java code will not look, there are a few people would ah, right? But
Bitwise operators allow us to manipulate a single "bit" in the primary data type of an integer, that is, bits. The bitwise operator performs a Boolean algebra on the corresponding bits in the two arguments and eventually produces a result.Bitwise
One of the most basic uses of computers is to perform mathematical operations, and as a computer language, Java also provides a rich set of operators to manipulate variables. We can divide the operators into the following groups:
Arithmetic
Binary OperatorsBecause data in the computer is in binary format, Java provides binary operators for direct operations. This is the bitwise operators and shift operators to be explained below.Binary operators can be used to operate numbers directly
Original Author: Rosen Jiang Source:Http://www.blogjava.net/rosen
Shift Operator
Including:"> Right shift"; ">> unsigned right shift"
Example:-5> 3 =-11111 1111 1111 1111 1111 1111 11111111 1111 1111 1111 1111 1111 1111The result is exactly the same
Bitwise Logical Operations, property settings
Bitwise logical operation in the efficient operation of the data to use a lot of high-level language in peacetime, most of the time we do not need to manually set these, because it has been encapsulated
One. Bitwise operatorsThe bit here is the symbol of the bits, bit bit operation.Viewing the PPT shows that there is more than one bitwise operator, which consists of several operators, even using the operation symbols previously defined.Two.
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.