InetAddressUtils { public static boolean isIPv6HexCompressedAddress(final String input) { int colonCount = 0; for(int i = 0; i < input.length(); i++) { if (input.charAt(i) == COLON_CHAR) { colonCount++; } } return colonCount <= MAX_COLON_COUNT && IPV6_HEX_COMPRESSED_PATTERN.matcher(input).matches(); } private  InetAddressUtils(); static boolean isIPv4Address(final String input); static boolean isIPv4MappedIPv64Address(final String input); static boolean isIPv6StdAddress(final String input); static boolean isIPv6HexCompressedAddress(final String input); static boolean isIPv6Address(final String input); static void formatAddress(
            final StringBuilder buffer,
            final SocketAddress socketAddress); static String getCanonicalLocalHostName();  }
@Test public void testInvalidIPv6AddressIncorrectGroupCount() { Assert.assertFalse(InetAddressUtils.isIPv6HexCompressedAddress("1:2::4:5:6:7:8:9")); Assert.assertFalse(InetAddressUtils.isIPv6HexCompressedAddress("1:2:3:4:5:6::8:9")); }