public IPAddressString adjustPrefixBySegment(boolean nextSegment) {
		if(isPrefixOnly()) {
			// Use IPv4 segment boundaries
			int bitsPerSegment = IPv4Address.BITS_PER_SEGMENT;
			int existingPrefixLength = getNetworkPrefixLength();
			int newBits;
			if(nextSegment) {
				int adjustment = existingPrefixLength % bitsPerSegment;
				newBits = Math.min(IPv6Address.BIT_COUNT, existingPrefixLength + bitsPerSegment - adjustment);
			} else {
				int adjustment = ((existingPrefixLength - 1) % bitsPerSegment) + 1;
				newBits = Math.max(0, existingPrefixLength - adjustment);
			}
			return new IPAddressString(IPAddressNetwork.getPrefixString(newBits), validationOptions);
		}
		IPAddress address = getAddress();
		if(address == null) {
			return null;
		}
		Integer prefix = address.getNetworkPrefixLength();
		if(!nextSegment && prefix != null && prefix == 0 && address.isMultiple() && address.isPrefixBlock()) {
			return new IPAddressString(IPAddress.SEGMENT_WILDCARD_STR, validationOptions);
		}
		return address.adjustPrefixBySegment(nextSegment).toAddressString();
	}
public IPAddressString adjustPrefixBySegment ( boolean nextSegment ) { if ( isPrefixOnly ( ) ) { int bitsPerSegment = IPv4Address . BITS_PER_SEGMENT ; int existingPrefixLength = getNetworkPrefixLength ( ) ; int newBits ; if ( nextSegment ) { int adjustment = existingPrefixLength % bitsPerSegment ; newBits = Math . min ( IPv6Address . BIT_COUNT , existingPrefixLength + bitsPerSegment - adjustment ) ; } else { int adjustment = ( ( existingPrefixLength - 1 ) % bitsPerSegment ) + 1 ; newBits = Math . max ( 0 , existingPrefixLength - adjustment ) ; } return new IPAddressString ( IPAddressNetwork . getPrefixString ( newBits ) , validationOptions ) ; } IPAddress address = getAddress ( ) ; if ( address == null ) { return null ; } Integer prefix = address . getNetworkPrefixLength ( ) ; if ( ! nextSegment && prefix != null && prefix == 0 && address . isMultiple ( ) && address . isPrefixBlock ( ) ) { return new IPAddressString ( IPAddress . SEGMENT_WILDCARD_STR , validationOptions ) ; } return address . adjustPrefixBySegment ( nextSegment ) . toAddressString ( ) ; }
Increases or decreases prefix length to the next segment boundary of the given address version's standard segment boundaries.
<p>
This acts on address strings with an associated prefix length, whether or not there is also an associated address value, see {@link IPAddressString#isPrefixOnly()}.
If there is no associated address value then the segment boundaries are considered to be at each byte, much like IPv4.
<p>
If the address string has prefix length 0 and represents all addresses of the same version,
and the prefix length is being decreased, then the address representing all addresses of any version is returned.
<p>
Follows the same rules as {@link #adjustPrefixLength(int)} when there is an associated address value:<br>
When prefix length is increased, the bits moved within the prefix become zero.
When a prefix length is decreased, the bits moved outside the prefix become zero.

Also see {@link IPAddress#adjustPrefixBySegment(boolean)}
@param nextSegment whether to move prefix to previous or following segment boundary
@return