convert a two Byte bit mask into a EnumSet
问题 I am reading a binary file that has values stored in bit masks, both 1 Byte bit masks and 2 Byte bit masks . Each bit in the masks act as a switch that indicates where an Event has transpired. Example of 1 Byte mask: 00000101 Indicates that Event one and Event 3 has transpired. Example of Enum public enum MyEnum { EventOne, EventTwo, ....; } I have created a Enum MyEnum (as per Item 32 in Effective java, Second Edition) of the events. How can the binary bit masks be read into an EnumSet