Here you can find the source of isIPv6(String address)
public static boolean isIPv6(String address)
//package com.java2s; //License from project: Open Source License import java.util.regex.Pattern; public class Main { private static final Pattern IPV6_PATTERN = Pattern.compile("^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$"); public static boolean isIPv6(String address) { return IPV6_PATTERN.matcher(address).matches(); }//from w ww.ja v a2s. c om }