protected boolean isChangedByMask(int maskValue, Integer segmentPrefixLength) throws IncompatibleAddressException {
		boolean hasBits = (segmentPrefixLength != null);
		if(hasBits && (segmentPrefixLength < 0 || segmentPrefixLength > getBitCount())) {
			throw new PrefixLenException(this, segmentPrefixLength);
		}
		
		//note that the mask can represent a range (for example a CIDR mask), 
		//but we use the lowest value (maskSegment.value) in the range when masking (ie we discard the range)
		int value = getSegmentValue();
		int upperValue = getUpperSegmentValue();
		return value != (value & maskValue) ||
				upperValue != (upperValue & maskValue) ||
						(isPrefixed() ? !getSegmentPrefixLength().equals(segmentPrefixLength) : hasBits);
	}
protected boolean isChangedByMask ( int maskValue , Integer segmentPrefixLength ) throws IncompatibleAddressException { boolean hasBits = ( segmentPrefixLength != null ) ; if ( hasBits && ( segmentPrefixLength < 0 || segmentPrefixLength > getBitCount ( ) ) ) { throw new PrefixLenException ( this , segmentPrefixLength ) ; } int value = getSegmentValue ( ) ; int upperValue = getUpperSegmentValue ( ) ; return value != ( value & maskValue ) || upperValue != ( upperValue & maskValue ) || ( isPrefixed ( ) ? ! getSegmentPrefixLength ( ) . equals ( segmentPrefixLength ) : hasBits ) ; }
returns a new segment masked by the given mask

This method applies the mask first to every address in the range, and it does not preserve any existing prefix.
The given prefix will be applied to the range of addresses after the mask.
If the combination of the two does not result in a contiguous range, then {@link IncompatibleAddressException} is thrown.