Orchard
A CIDR processing library for Java. Supports IPv4 and IPv6 Addresses.
Installation
<dependency>
<groupId>com.aaronbedra</groupId>
<artifactId>orchard</artifactId>
<version>0.2.0</version>
</dependency>
Usage
import com.aaronbedra.orchard.CIDR;
if (CIDR.valueOf("1.1.1.0/24").contains("1.1.1.2")) {
// do stuff
} else {
// do other stuff
}
import com.aaronbedra.orchard.CIDR;
int mask = CIDR.valueOf("1.1.1.0/24").getMask();