public boolean isIp4() {
        return (version() == Ip4Address.VERSION);
    }
@Test
    public void testIsIp4() {
        IpAddress ipAddress;

        // IPv4
        ipAddress = IpAddress.valueOf("0.0.0.0");
        assertTrue(ipAddress.isIp4());

        // IPv6
        ipAddress = IpAddress.valueOf("::");
        assertFalse(ipAddress.isIp4());
    }