### Question:
IPv4 implements Writable, Comparable<IPv4> { @Override public int compareTo(IPv4 o) { byte[] obytes = o.getBytes(); for (int i = 0; i < 4; i++) { if (this.ipBytes[i] > obytes[i]) { return 1; } else if (this.ipBytes[i] < obytes[i]) { return -1; } } return 0; } 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 testCompareTo() throws InvalidAddressException { IPv4 ip1 = new IPv4("163.152.23.1"); IPv4 ip2 = new IPv4("163.152.23.2"); IPv4 ip3 = new IPv4("177.234.123.12"); IPv4 ip4 = new IPv4("177.234.123.12"); assertTrue(ip1.compareTo(ip2) == -1); assertTrue(ip2.compareTo(ip1) == 1); assertTrue(ip3.compareTo(ip1) == 1); assertFalse(ip3.compareTo(ip2) != 1); assertTrue(ip4.compareTo(ip3) == 0); }