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 testToStringWithInterface2() throws UnknownHostException {
        byte[] bytes = new byte[] { 0x10,(byte)0x80, 0,0, 0,0, 0,0, 0,8, 8,0, 0x20,0x0c, 0x41,0x7a };
        Inet6Address address = Inet6Address.getByAddress(null, bytes, 1);
        // Verify Guava's InetAddresses.toAddrString() includes the interface.
        // If this assert fails, we can use InetAddresses.toAddrString() instead of InetAddressUtil.toString().
        assertNotEquals(-1, InetAddresses.toAddrString(address).indexOf('%'));
        assertEquals("1080::8:800:200c:417a", InetAddressUtil.toString(address));
    }