code: 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;
      }
docs: Returns a list of all flags, which are set in the value
  
  @param value
  @return list of all flags that are set