I don't know what this means "1 << 2" in :
public static final int MODIFY_METADATA = 1 << 2; // modify object
Please help me!
If you want to know why would use use 1 << 2
rather than 4 which is the same value, it because you explicitly want to be using a bit mask e.g.
public static final int FLAG0 = 1 << 0;
public static final int FLAG1 = 1 << 1;
public static final int MODIFY_METADATA = 1 << 2;
Shows each value is in a bit mask.
Java Operators
Bitwise Operations
<<
is the left bit shift operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With