viperv25
03-20-2005, 11:08 PM
Hello everyone,
I know this may be a easy program for you all, but I am struggling on it.
I need to provide two bit strings like 1011 0001 and 0010 0110 and display:
Bitwise | 1111 0111
Bitwise & 0010 0000
Bitwise ^ 1001 0111
I keep getting the decimal version of the number.
My Code:
public static void main(String args[]){
int x = 1011 0001;
int x2 = 0010 0110;
System.out.println("OR operator");
System.out.println(x|x2);
System.out.println("AND operator");
System.out.println(x&x2);
System.out.println("XOR operator");
System.out.println(x^x2);
}
I am not a programmer. Barely surviving this stuff.
Any advise or help would be much appreciated.
I know this may be a easy program for you all, but I am struggling on it.
I need to provide two bit strings like 1011 0001 and 0010 0110 and display:
Bitwise | 1111 0111
Bitwise & 0010 0000
Bitwise ^ 1001 0111
I keep getting the decimal version of the number.
My Code:
public static void main(String args[]){
int x = 1011 0001;
int x2 = 0010 0110;
System.out.println("OR operator");
System.out.println(x|x2);
System.out.println("AND operator");
System.out.println(x&x2);
System.out.println("XOR operator");
System.out.println(x^x2);
}
I am not a programmer. Barely surviving this stuff.
Any advise or help would be much appreciated.