Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

bit operation question  RSS feed

 
dx wu
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all:
cloud someone give me some more detail course or tutorials about java bit operation. the question is:

code:

construct a method implement to reverse a int number,for example
: 1101 0111 1010 0101, the function must reverse the bit ,that means the return value is 1010 0101 1110 1011


I have no idea about this kind of question .
thanks for your feedback.
 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot answer your question, but I can get you started in the right direction. I don't remember everything I learned about bitwise operators a long time ago, but it is really not as hard as it seems. And any good tutorial on bit shifting will teach you what you need to know. A tutorial on this topic does not need to be Java specific. Having said that, there is a short, easy to understand tutorial on cprogramming.com
it is http://www.cprogramming.com/tutorial/bitwise_operators.html
that shows you how to use the bitwise operators and what they do, so just do it in Java instead of C or C++.
If that helps any, make your best attempt at working out the problem, and let us know if you get stuck. I will read up on this as well, and I should be able to help you figure it out.

by the way, isn't this your THIRD post asking the same question? I hope you don't think someone is going to do all the work for you.
[ March 30, 2007: Message edited by: Eric Daly ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!