code: public static boolean checkFlagExclusiveSet(int flags, int flag, int mask)
    {
      int f = flags & flag;
      if (f != 0) {
        return ((flags & mask & ~flag) != 0)? false:true;
      } else {
        return false;
      }
    }
docs: Utility function to check if a particular flag is set exclusively
  given a particular set of flags and a mask
  @param flags flags to check
  @param flag bit for flag of interest (is this flag set or not)
  @param mask bitmask of bits to check
  @return true if flag is exclusively set for flags & mask