Answers for "left shift in java"

5

right shift operator in java

int x  = 25;
System.out.println(x);	    //     1 1 0 0 1 : 25
System.out.println(x >> 2); //         1 1 0 : 6
System.out.println(x << 2); // 1 1 0 0 1 0 0 : 100
// Negative numbers are stored as two's complement
// and will trail right shifts with one
// Unsigned operators <<< >>> ignore sign and trail with 0
Posted by: Guest on December-14-2020
0

left shift in java

int a=a<<n;
//where n is the number of places a is shifted towards left.
Posted by: Guest on May-03-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language