This week's book giveaway is in the OCAJP 8 forum.We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!

# Bitwise Operators

Anupama Kota
Greenhorn

Joined: May 21, 2001
Posts: 22
Hi
char v1 = ')';//41
byte v2 = 13;

~v1 = -42;
v1&v2 = 9;
v1|v2 =45;

I know the process that the value is coveted to binary and then operate both regarding to the operator.
But in the exam it is time taken process.That we have to rember all Ascii values.May be some times it goes worng in recollecting.
Is there any other simple way like 12>>2 is 12 / (2(power)2)??
Haining Mu
Ranch Hand

Joined: Jun 01, 2001
Posts: 51
really? are we require to remember ASCII?
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 6337

16

No, you are not expected to remember the ASCII code table.
It helps to know how to convert numbers from one base to another though. For bitwise operation questions, it's best to know the binary representations of 0x00 to 0x0F, how to get the one's complement and two's complement, how to convert from decimal to binary and vice versa.
Junilu

Anupama Kota
Greenhorn

Joined: May 21, 2001
Posts: 22
Hi
Junilu
Yes,I understand how to convert both binary to hex,oct and vice versa,1's and 2's complement.But if this type of question come in Exam then what we have to do.
We have to know na about ")" that character is represented as decimal 41 .How we know this??
If mine thinking is wrong pl correct me.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 6337

16

I think it's highly unlikely that Sun will give any questions that require you to memorize the ASCII code table. The questions I got that involved bitwise operators were pretty straightforward. Don't worry about it.
Junilu

I agree. Here's the link: http://aspose.com/file-tools

subject: Bitwise Operators