I'm using `java.net.Inet6Address` to validate if an input string is a valid **IPv6 address** or not.

Here is my code snippet:

```
public static boolean isValidIPv6ddress(String address) {
    if (address.isEmpty()) {
        return false;
    }
    try {
        Object res = InetAddress.getByName(address);
        return res instanceof Inet6Address;
    } catch (final UnknownHostException ex) {
        return false;
    }
}

```

Unfortunately the above method returns `true` even for the following inputs which are **invalid**:

```
System.out.println(isValidIPv6ddress("2A00:17C8:50C:0000:0000:0000:0000:00001"));
System.out.println(isValidIPv6ddress("2A00:17C8:50C:0000:0000:00000000000000:0000:00001"));
System.out.println(isValidIPv6ddress("2A00:17C8:50C:00001235:0000:00000000000000:0000:00001"));

```

Does the API **ignore leading zeroes**? Or is there a **bug** in the API?