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 operators
Relational operators
Bitwise operators
logical operators
Assignment operators
Other operators
This article only looks at the
Front.
Bitwise operators are very low-level operations and are not commonly used because they are not intuitive. However, its speed is very fast, and reasonable use can achieve very good results. This article will introduce the operator-bitwise operator, which is often overlooked in JavaScript
Binary representation
All values in the ECMAScript are stored in IEEE-754 64-bit format, but the
I use resources on a school public computer, but I often find that some people use computers to install games and other programs, such as QQ and Other Combat Games, which greatly affects our work. however, it is hard to say on the face. sometimes it brings a lot of viruses to the computer, so I want to make some settings on the computer, so that others can only perform some formal use when using the computer? Now we have a solution. You can try it as
Symptom: In a company's internal LAN, one of the computers cannot see other computers in the Network Neighborhood, but other computers can see each other in their "Network Neighborhood".
Failure analysis and removal: After understanding, the network within this company is connected through a switch. According to the fault analysis, this fault may be the network
Failure phenomenon: Intranet within the enterprise. One of the computer and services in the marketing department of a computer at the start, there are always two computer IP address conflicts. Changing the IP address of both computers is still a problem, and in the case of conflict, only one computer can surf the Internet.
Fault analysis and elimination: According to the fault analysis, this fault may be the computer network IP address conflict or ph
operation,0111-0101-1010-01100000-0000-0000-1111As you can see, the result of this bitwise operation is to intercept the latter four bits of data. In special cases, the interception of data is also a feature of the bit operation.B. Similarly, the use of the bitwise operator is similar to the bitwise operator. The bitwise
Original article, if reproduced, please indicate the source: http://blog.csdn.net/yihui823/article/details/6754038
In fact, it is the same as Java, and Java is also common.
Our understanding of numbers starts from decimal. Since childhood, the education started from 1 + 9 = 10. However, for today's computers, their world is a binary world. The computer uses a high level to indicate 1, and a low level to indicate 0.
If we want to represent the decimal
Look at the code first:
$a =8; $b =~ $a; Bitwise reverse echo "\ $a =". $a. "
Output Result:
$a =8$b=-9
The result is different from what I thought, because in the PHP Chinese manual it says: ~ $a not (bitwise non) sets the bit to 1 in the $a and vice versa. I simply understand that: 0 becomes 0. The original bitwise counter to the decimal output is not simply
Reprinted and amended, original connection: http://www.cnblogs.com/911/archive/2008/05/20/1203477.htmlA bitwise operation is a binary-based operation. In system software, it is often necessary to deal with bits problems.the C language provides 6 bit manipulation operators .These operators can only be used for integer operands, that is, only for signed or unsigned char,short,int and long types.List of bit operators provided by the C language:operator m
Code is as follows: x ^ y // execute Addition(X y)
Let's do a two-digit addition without considering carry.Copy codeCode: 11 + 01 = 100 // original algorithm// Calculated using a calculated expression11 ^ 01 = 10(11 01) // Here, when we use the ordinary addition to calculate the two numbers, we can get 10 + 10 = 100.// But we do not need addition. So if we want to use another method to calculate the two numbers again10 ^ 10 = 00(10 10)
Here we come to the conclusion that, in fact, the "00"
Bitwise operations are one of the basic operations in C/C ++. Even so, it is a strange operation for most programmers-most programmers seldom use bitwise operations. This article first briefly introduces the basic bitwise operators and their usage (when to use them), and then introduces several typical applications of bitwise
in C #, you can perform a bitwise logical operation on an integer operand. The meaning of the bitwise logical operation is that each bit of the operand is taken sequentially, and the logical operation of each bit is the result of each bit of the result value. The bit logical operators supported by C # are shown in table 2.9.
Operation symbols
Significance
Operand type
Type of o
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 operations come from low-level operations in the C language. We often have to directly manipulate the hardware, we need to frequently set the hardware register bit
Bit operations
The various operations described earlier are performed in bytes as the most basic bit. However, in many system programs, it is often required to perform operations or processing at the bit level. C language provides the function of bitwise operation, which makes C language can be used as assembly language to write system program.The bitwise operator C language provides six kinds of
Summary
Bitwise operations are one of the basic operations in C/C ++. Even so, it is a strange operation for most programmers-most programmers seldom use bitwise operations. This article first briefly introduces the basic bitwise operators and their usage (when to use them), and then introduces several typical applications of
Bitwise operators include: | bitwise OR or, bitwise AND and, ^ bitwise XOR or XOR ,~ Not,
○ Hexadecimal conversion※Convert decimal to binary.※Convert binary to decimal.○ | Bitwise OR operator○ Bitwise AND Operators○ ^
true and false two cases, the result value is stored with the BOOL type variable. Note: To determine whether two numbers are equal, use = = (double equals)4. Logical operator: (logic and), | | (logical OR),! (Logical non)An expression consisting of logical operators, and the result is not true or false.: The result of the entire logical expression is true when the expression on both sides of the operator is trueThe result of the entire logical expression is false when the expression on both sid
Bitwise operations in Java
Java bit operator
Bitwise operators are used to operate binary bits. Java provides bitwise operators as shown below:
Bitwise operator (>>,
Basic knowledge
Complement
All Integer types (except char) are signed integers. This means they can both represent positive numbers and negative numbers.
Bitwise operators
Bitwise operators allow placement of the bits specified in the integer number. If both the left and right arguments are strings, the bitwise operator will manipulate the ASCII value of the character.
Do not move more than 32 bits to the right on 32-bit systems. Do not move left when the result may be more than 32 digits.
Example name result$a
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.