Skip to content

Commit 446ce79

Browse files
committed
feat: Add Bitwise4 class demonstrating left shift operation
Add a program that: - Initializes an integer using a binary literal - Applies a left shift (`<<`) by 2 bits - Prints the result, showing how bits are shifted to the left - Demonstrates the use of bitwise shift operators in Java.
1 parent 9085532 commit 446ce79

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
public class Bitwise4
2-
{
1+
public class Bitwise4 {
32
public static void main(String[] args) {
43
int x = 0b100; //10;
54

65
int y;
7-
y = x<<2;
6+
y = x<<2; //left shift operator. shifting x value by the 2 bits.
87
System.out.println(y);
98
}
10-
}
9+
}

0 commit comments

Comments
 (0)