I have seen a piece of Java code about enum
:
public enum Classname {
UIViewAutoresizingNone(0),
UIViewAutoresizingFlexibleLeftMargin(1 << 0),
UIViewAutoresizingFlexibleWidth(1 << 1),
UIViewAutoresizingFlexibleRightMargin(1 << 2),
UIViewAutoresizingFlexibleTopMargin(1 << 3),
UIViewAutoresizingFlexibleHeight(1 << 4),
UIViewAutoresizingFlexibleBottomMargin(1 << 5);
private int value;
// constructor
private Classname(int v) {
this.value = v;
}
public int value() {
return value;
}
}
System.out.println(Classname.UIViewAutoresizingFlexibleBottomMargin.value);
output: 32
I suppose the result is 2 to the power of 5.
generally, if it is
i << j
What does the express(i << j) mean? How can i and j affect the result? Can someone point me to a tutorial?