Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Bitwise-operations/Java/bitwise-operations-1.java
Normal file
11
Task/Bitwise-operations/Java/bitwise-operations-1.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
public static void bitwise(int a, int b){
|
||||
System.out.println("a AND b: " + (a & b));
|
||||
System.out.println("a OR b: "+ (a | b));
|
||||
System.out.println("a XOR b: "+ (a ^ b));
|
||||
System.out.println("NOT a: " + ~a);
|
||||
System.out.println("a << b: " + (a << b)); // left shift
|
||||
System.out.println("a >> b: " + (a >> b)); // arithmetic right shift
|
||||
System.out.println("a >>> b: " + (a >>> b)); // logical right shift
|
||||
System.out.println("a rol b: " + Integer.rotateLeft(a, b)); //rotate left, Java 1.5+
|
||||
System.out.println("a ror b: " + Integer.rotateRight(a, b)); //rotate right, Java 1.5+
|
||||
}
|
||||
4
Task/Bitwise-operations/Java/bitwise-operations-2.java
Normal file
4
Task/Bitwise-operations/Java/bitwise-operations-2.java
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
a <<= 3;
|
||||
a = a << 3;
|
||||
a *= 8; //2 * 2 * 2 = 8
|
||||
a = a * 8;
|
||||
Loading…
Add table
Add a link
Reference in a new issue