bitmask question?

后端 未结 6 1967
面向向阳花
面向向阳花 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:15

    I don't understand the question "how it is calculated to give the follow result". (What is calculated?)

    The main thing to understand is that all computer values are stored in binary. Any number will be a combination of 0 and 1 bit. Some numbers only have one 1 bit.

    http://en.wikipedia.org/wiki/Mask_(computing)

提交回复
热议问题