class NetUtils {

    public static boolean isIPv6AddressValid(String cidr) {
        if (cidr == null) {
            return false;
        }

        String[] values = cidr.split("/");
        try {
            // when given an IP address, InetAddress.getByName validates the ip
            // address
            InetAddress addr = InetAddress.getByName(values[0]);
            if (!(addr instanceof Inet6Address)) {
                return false;
            }
        } catch (UnknownHostException ex) {
            return false;
        }

        if (values.length >= 2) {
            int prefix = Integer.parseInt(values[1]);
            if (prefix < 0 || prefix > 128) {
                return false;
            }
        }
        return true;
    }

    private  NetUtils();

}