Created
June 19, 2018 01:21
-
-
Save thmain/fa2d85d791f29d970df7610d4ffc18e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LeftRightShift { | |
static void LeftShift(int n){ | |
int x = n<<1; | |
System.out.println("n<<1, Left shift by 1 of n: "+ n + " is : " + x); | |
} | |
static void RightShift(int n){ | |
int x = n>>1; | |
System.out.println("n>>1, Right shift by 1 of n: "+ n + " is : " + x); | |
} | |
public static void main(String[] args) { | |
int n = 10; | |
LeftShift(n); | |
RightShift(n); | |
n = 62; | |
LeftShift(n); | |
RightShift(n); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment