This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there a easy way to find the solution?

 
Juan Zhang
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This post belongs in Java General(Beginner) I'm moving it there.
 
Carl Trusiak
Sheriff
Posts: 3340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic