The shift operator is also for the binary "bit", which mainly includes the left shift operator (>>), and the signed right shift operator (>>).
1. Left shift operatorThe left-shift operator, represented by "public class Data17{public static void
Define a test class complex, where the method of the member function is overloaded with the + 、-、 front + +, the front--、 post + +, and the back--these 6 operators, of course, these 6 operators can also be overloaded with the method of the
Operation
Right shifts the bits of the expression without preserving the symbol.
result = expression1 >>> expression2
Parameters
Result
Any variable .
Expression1
Any expression .
Expression2
Any expression.
Description
The >>> operator shifts the
Using the sample
result = expression1 >>> expression2
Where result is any variable.
Expression1 is any expression.
Expression2 is any expression.
Description of unsigned right-shift operators in JavaScript
The >>> operator shifts the
Operation
Moves the bit of the expression right, keeping the symbol unchanged.
result = expression1 >> expression2
Parameters
Result
Any variable .
Expression1
Any expression .
Expression2
Any expression.
Description
The >> operator
One, Java bit operation1. Presentation method:In the Java language, the binary number is represented by a complement, the highest bit is the sign bit, the sign bit for positive numbers is 0, and the negative is 1. The complement representation needs
Bitwise operators defined by Java performs operations on digits of the integer type directly. These integer types include long, Int, short, Char, and byte. Table 4-2 lists bitwise operations:Table 4.2-bit operators and their results
Operator result~
There are three kinds of shift operators in Java>>: Right shift operator, NUM >> 1, equivalent num divided by 2>>>: Unsigned Right shift, ignore sign bit, empty 0
1. Left shift operator
The left shift operator 1) Its general format is as
Java bit operations
Bit operations are binary operations that are directly supported by the CPU. Therefore, bit operations have high efficiency. In some cases, proper application of bit operations will have high performance. Usually some encryption
Bit arithmetic notThe bitwise operation not is represented by a negative number (~), which is one of the few operators related to binary arithmetic in ECMAScript.Bitwise arithmetic NOT is a three-step process:1. Convert the operand to a 32-digit
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
The Java shift operators are all about these three kinds of:> (with symbols right) and >>> (unsigned Right shift). 1 . Left shift operator left shift operator 2) The arithmetic rules move all numbers to the left of the corresponding digits in binary
bit arithmeticThe operation component of a bitwise operation can only be integer or character data, and the bitwise operation considers the operand as a bit string information composed of binary bits, and completes the specified operation by bit,
Puzzle 27: unpredictable I valueYour task is still to point out thisProgramWhat will be printed.Class shifty{Static void main (){Int I = 0;While (-1 I ++;System. Console. writeline (I );}}
Confusing 27: unpredictable I valueConstant-1 is the int
Operation
Priority
Associativity
1
Suffix Operator
[]. () (Function call)
Left to right
2
Single Object Operator
! ~ ++ -- + (Single-operand)-(single-operand)
From right to left
3
Create
Java common operator Java, operator Auto increment and auto decrementprefix : the operator is in front of the variable. The operation is performed first, and then the value is generated.suffix : the operator is behind the variable. The value of the
The following code:public class Example027 {public static void main (string[] args) {int i = 0;while ( -1 Result Description: put the above program into eclipse, and the output line will prompt "unreachable code". That is, the while loop is a dead
Bit operationsThe operation component of the bit operation can only be integer or character data, and the bitwise operation regards the Operation object as a bit string information composed of two digits, completes the specified operation by bit,
Data is stored in bytes on the computer, 1 bytes equals 8 bits (1byte=8bit), and the computer can recognize only 0 and 1 of these two digits, so 1 bytes can represent 256 different information according to the arrangement, i.e. 28 (0 and 12 possible,
WML script is part of the Unlimited Application protocol WAP application layer, which can be used to add client-side processing logic to WML cards and cards, and the latest version is the 1.1 version. The WML Script1.1 is specified as modified and
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.