Saturday, 15 February 2014

android - How to know if a decimal number is 0x1000 or 0x0100 -


I have set up the data, with the column value of the type name, I have to know that the value is 0x1000 or 0x0010 or 0x0200 , I have no idea, can you please help

Programming in Android accept some optional How to save integer numbers.

  int mask = 0x1000;  

is valid. You can compare it to a normal int like

  if (type == mask) // something  

you can work with bitwire work Can also do If you are using a mask then the most relevant here is probably bitwise and (& amp;) because you have called it a mask, I am going to tell you how the Bitware operation works and tells you that How to invite them. If you do not know, please leave a comment and I will update it.

  int result = type & amp; Mask; // where there are both types and mask ints if the result (== 0) {// was not match type mask} and if (result == type) {// all the bits in the mask were present in type} else {// something With bits type mask matching}  

I think where you want to go.

Happy coding! If you have any questions leave a comment.


No comments:

Post a Comment