code: private static int switchFlag(final int flags, final int mask, final boolean value) {
  		int newFlags = value ? flags | mask : flags & ~mask;
  		return newFlags;
  	}
docs: A utility method to set or clear one or more bits in the given set of flags.
  
  @param flags the current set of flags.
  @param mask the bit mask for the flags to set/clear.
  @param value true to set the flag(s), false to clear.
  @return the new set of flags.