Left Shift "<<"
The left shift "<<" shifts the highest order bit to the right for number of times the user specified.
Syntax
value << position
The value is increased with the double effect according to the value of the position specified.
Example
int value = 10;
int position = 2;
int result = value << position;
So the final value that will be stored in the result variable will be
40.(10,20,40)
Right shift ">>"
The right shift ">>" shifts the lowest order bit to the left for number of times the user specified.
Syntax
value >> position
The value is decrease with the double effect according to the value of the position specified.
Example
int value = 10;
int position = 2;
int result = value >> position;
So the final value that will be stored in the result variable will be
2.(10,5,2.5(2))
Kindly Bookmark this Post using your favorite Bookmarking service:
Related Posts: Java Codes
0 comments: