public static < T extends Characteristic > List < T > getAllMatching ( long value , T [ ] flags ) { List < T > list = new ArrayList <> ( ) ; // check every characteristic if it fits for ( T ch : flags ) { // read mask long mask = ch . getValue ( ) ; // use mask to check if flag is set if ( ( value & mask ) != 0 ) { list . add ( ch ) ; } } return list ; }
Returns a list of all flags which are set in the value