android/guava/src/com/google/common/net/InetAddresses.java
public static boolean isCompatIPv4Address(Inet6Address ip) {
    if (!ip.isIPv4CompatibleAddress()) {
      return false;
    }

    byte[] bytes = ip.getAddress();
    if ((bytes[12] == 0)
        && (bytes[13] == 0)
        && (bytes[14] == 0)
        && ((bytes[15] == 0) || (bytes[15] == 1))) {
      return false;
    }

    return true;
  }
public static boolean isCompatIPv4Address(Inet6Address ip) {
    if (!ip.isIPv4CompatibleAddress()) {
      return false;
    }

    byte[] bytes = ip.getAddress();
    if ((bytes[12] == 0)
        && (bytes[13] == 0)
        && (bytes[14] == 0)
        && ((bytes[15] == 0) || (bytes[15] == 1))) {
      return false;
    }

    return true;
  }
Evaluates whether the argument is an IPv6 "compat" address.

<p>An "IPv4 compatible", or "compat", address is one with 96 leading bits of zero, with the
remaining 32 bits interpreted as an IPv4 address. These are conventionally represented in
string literals as {@code "::192.168.0.1"}, though {@code "::c0a8:1"} is also considered an
IPv4 compatible address (and equivalent to {@code "::192.168.0.1"}).

<p>For more on IPv4 compatible addresses see section 2.5.5.1 of <a target="_parent"
href="http://tools.ietf.org/html/rfc4291#section-2.5.5.1">RFC 4291</a>.

<p>NOTE: This method is different from {@link Inet6Address#isIPv4CompatibleAddress} in that it
more correctly classifies {@code "::"} and {@code "::1"} as proper IPv6 addresses (which they
are), NOT IPv4 compatible addresses (which they are generally NOT considered to be).

@param ip {@link Inet6Address} to be examined for embedded IPv4 compatible address format
@return {@code true} if the argument is a valid "compat" address