Fri Jan 30, 2009 12:45 am
x y x&y
-----------------------------
0 0 0
0 1 0
1 0 0
1 1 1
byte x = 50;
byte y = 51;
byte result = (byte) (x&y);
System.out.println("Result of x&y= : " + result );
00110010
00110011
-------------
00110010
int xInt = 30;
int yInt = 31;
int result = (xInt&yInt);
System.out.println("Result of x&y (Integers)= : " + result );
Result of x&y (Integers)= : 30
x y x|y
-----------------------------
0 0 0
0 1 1
1 0 1
1 1 1
byte x = 50;
byte y = 51;
byte result = (byte) (x|y);
System.out.println("Result of x|y= : " + result );
The result equal = 51
00110010
00110011
-------------
00110011
int xInt = 30;
int zInt=33;
int result = (xInt|zInt);
System.out.println("Result of x|y (Integers)= : " + result );
Result of x|y (Integers)= : 63
x y x^y
-----------------------------
0 0 0
0 1 1
1 0 1
1 1 0
byte x = 50;
byte y = 51;
byte result = (byte) (x^y);
System.out.println("Result of x^y= : " + result );
00110010
00110011
-------------
00000001
int xInt = 30;
int zInt=31;
int result = (xInt^zInt);
System.out.println("Result of x^y (Integers)= : " + result );
Result of x^y (Integers)= : 1
~00110010 = 11001101
int xInt = 30;
int result = ~xInt;
System.out.println("Result of ~xInt(Integers)= : " + result );
Result of ~xInt(Integers)= : -31
Fri Jun 14, 2013 1:17 am
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.