/** * Get the count of available addresses. * Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false. * @return the count of addresses, may be zero. */ public int getAddressCount() { int count = broadcast() - network() + (isInclusiveHostCount() ? 1 : -1); return count < 0 ? 0 : count; }
/** * Get the count of available addresses. * Will be zero for CIDR/31 and CIDR/32 if the inclusive flag is false. * @return the count of addresses, may be zero. */ public int getAddressCount() { int count = broadcast() - network() + (isInclusiveHostCount() ? 1 : -1); return count < 0 ? 0 : count; }
private int high() { return (isInclusiveHostCount() ? broadcast() : broadcast() - network() > 1 ? broadcast() -1 : 0); }
private int high() { return (isInclusiveHostCount() ? broadcast() : broadcast() - network() > 1 ? broadcast() -1 : 0); }
private int low() { return (isInclusiveHostCount() ? network() : broadcast() - network() > 1 ? network() + 1 : 0); }
private int low() { return (isInclusiveHostCount() ? network() : broadcast() - network() > 1 ? network() + 1 : 0); }