public static String toString(InetAddress inetAddress) {
        if (inetAddress instanceof Inet6Address) {
            String address = InetAddresses.toAddrString(inetAddress);
            // toAddrString() returns any interface/scope as a %-suffix,
            // see https://github.com/google/guava/commit/3f61870ac6e5b18dbb74ce6f6cb2930ad8750a43
            int percentIndex = address.indexOf('%');
            return percentIndex < 0 ? address : address.substring(0, percentIndex);
        } else {
            return inetAddress.getHostAddress();
        }
    }
@Test
    void testToString() {
        assertEquals("1080::8:800:200c:417a", toString("1080:0:0:0:8:800:200C:417A"));
        assertEquals("1080::8:0:0:417a", toString("1080:0:0:0:8:0:0:417A"));
        assertEquals("::8190:3426", toString("::129.144.52.38"));
        assertEquals("::", toString("::"));

        assertEquals("0.0.0.0", toString("0.0.0.0"));
        assertEquals("222.173.190.239", toString("222.173.190.239"));
    }