jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes Is there a easy way to find the solution? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is there a easy way to find the solution?" Watch "Is there a easy way to find the solution?" New topic
Author

Is there a easy way to find the solution?

Juan Zhang
Greenhorn

Joined: Apr 19, 2001
Posts: 13
Hi,
Is there a easy way to find the solution by hand calculation?
1) int a = 0x67
int b = 0xBD
a^b = ?
2)(byte)0x81 >> 2 = ?
Thanks
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
This post belongs in Java General(Beginner) I'm moving it there.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Sure, one of the reasons that hexadecimal is useful in programming is one hexdigit can represent 4 bits and 1 byte can easily be represented by 2 hexdigits.
0x0 = 0000
0x1 = 0001
0x2 = 0010
0x3 = 0011
0x4 = 0100
0x5 = 0101
0x6 = 0110
0x7 = 0111
0x8 = 1000
0x9 = 1001
0xA = 1010
0xB = 1011
0xC = 1100
0xD = 1101
0xE = 1110
0xF = 1111
So, 0x67 = 0110 0111, 0xBD = 1011 1101 and 0x81 = 1000 0001
Read the Story Cat and Mouse Game with Bits to see how the operations work
------------------
Hope This Helps
Carl Trusiak, SCJP2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a easy way to find the solution?
 
Similar Threads
2's compliment to decimal value..?
switch statement
how to apply continue statement in struts logic:iterate tag
JNI: Wrapping an Existing C Library-Best Practices?
JavaScript Add a Row