### Question:
IPv4 implements Writable, Comparable<IPv4> { public boolean matchSubnet(String addr) throws InvalidAddressException { int maskIndex; if ((maskIndex=addr.indexOf('/')) != -1) { IPv4 other = new IPv4(addr.substring(0, maskIndex)); int maskLen = Integer.parseInt(addr.substring(maskIndex+1)); IPv4 subnetMask = IPv4.getSubnetMask(maskLen); if (this.and(subnetMask).equals(other.and(subnetMask))) { return true; } else { return false; } } else { throw new InvalidAddressException(); } } IPv4();  IPv4(byte[] bytes);  IPv4(String ipAddress); static IPv4 getSubnetMask(int len); void set(String ipAddress); void set(byte[] bytes); byte[] getBytes(); boolean matchSubnet(String addr); boolean matchGeoIP(/* country code */); IPv4 and(IPv4 other); @Override boolean equals(Object o); @Override int compareTo(IPv4 o); @Override String toString(); @Override int hashCode(); @Override void readFields(DataInput in); @Override void write(DataOutput out);  }### Answer:
@Test public final void testMatchSubnet() throws InvalidAddressException { IPv4 ip1 = new IPv4("163.152.23.223"); assertTrue(ip1.matchSubnet("163.152.23.0/1")); assertFalse(ip1.matchSubnet("163.152.23.0/28")); }