Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datatypes

 
Angela D'souza
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have int i;
I want to extract the bits out the integer, then I want to check it bits on, if on then i want to put it's value into String. How can I do this?
Thanks,
Angela
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do that using a bitmask. Basically you do a bitwise AND with a mask, designed to pick out the one or more bits you're looking for. You can easily add numbers into Strings using the appropriate String constructor.
--Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic