public static < E extends Enum < E > & ByteEnum > EnumSet < E > intToSet ( Class < E > eclass , int flags ) { EnumSet < E > set = EnumSet . noneOf ( eclass ) ; for ( E value : eclass . getEnumConstants ( ) ) { if ( ( flags & toIntFlag ( value ) ) != 0 ) { set . add ( value ) ; } } return set ; }
Convert an int representation of ByteEnum flags into an EnumSet .