public int getTrailingBitCount ( boolean network ) { int count = getDivisionCount ( ) ; if ( count == 0 ) { return 0 ; } long back = network ? 0 : getDivision ( 0 ) . getMaxValue ( ) ; int bitLen = 0 ; for ( int i = count - 1 ; i >= 0 ; i -- ) { IPAddressDivision seg = getDivision ( i ) ; long value = seg . getDivisionValue ( ) ; if ( value != back ) { return bitLen + seg . getTrailingBitCount ( network ) ; } bitLen += seg . getBitCount ( ) ; } return bitLen ; }
Returns the number of consecutive trailing one or zero bits . If network is true returns the number of consecutive trailing zero bits . Otherwise returns the number of consecutive trailing one bits .