org.apache.commons.net.util
public class: SubnetUtils [javadoc |
source]
java.lang.Object
org.apache.commons.net.util.SubnetUtils
A class that performs some subnet calculations given a network address and a subnet mask.
Also see:
- http://www.faqs.org/rfcs/rfc1519.html
- author:
- @apache.org>
- since:
2.0 -
| Nested Class Summary: |
|---|
| public final class | SubnetUtils.SubnetInfo | Convenience container for subnet summary information. |
| Constructor: |
public SubnetUtils(String cidrNotation) {
calculate(cidrNotation);
}
Constructor that takes a CIDR-notation string, e.g. "192.168.0.1/16" Parameters:
cidrNotation - A CIDR-notation string, e.g. "192.168.0.1/16"
|
public SubnetUtils(String address,
String mask) {
calculate(toCidrNotation(address, mask));
}
Constructor that takes two dotted decimal addresses. Parameters:
address - An IP address, e.g. "192.168.0.1"
mask - A dotted decimal netmask e.g. "255.255.0.0"
|
| Method from org.apache.commons.net.util.SubnetUtils Summary: |
|---|
|
getInfo, pop |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.commons.net.util.SubnetUtils Detail: |
public final SubnetInfo getInfo() {
return new SubnetInfo();
}
Return a SubnetInfo instance that contains subnet-specific statistics |
int pop(int x) {
x = x - ((x > > > 1) & 0x55555555);
x = (x & 0x33333333) + ((x > > > 2) & 0x33333333);
x = (x + (x > > > 4)) & 0x0F0F0F0F;
x = x + (x > > > 8);
x = x + (x > > > 16);
return x & 0x0000003F;
}
|