bitmask question?

后端 未结 6 1917
面向向阳花
面向向阳花 2021-01-31 04:46

I have the follow:

public static final int LIMIT_ONE = 1;
public static final int TRADEABLE = (1 << 1);
public static final int SELLABLE = (1 << 2);
         


        
6条回答
  •  滥情空心
    2021-01-31 05:03

    My guess would be that you take some number, such as your example 12414, and figure out what properties are contained within it.

    For example, since 12414 is 11000001111110 in binary, whatever it is attached to is tradeable, because ANDing this number with the mask will give you a 1 in the second bit.

提交回复
热议问题