RFC 3484 defines the default address selection for IPv6. It is basically defining a number of rules for ordering the result from getaddrinfo() to observe standard behaviour (prefer ipv6 if supported, allow administrative redefinition). Linux and Windows have elaborate mechanisms to influence getaddrinfo (net sh int ipv6 prefixpolicy on Windows and /etc/gai.conf on Linux).
Unfortunatelly Java is re-ordering that answer (in Java_java_net_Inet6AddressImpl_lookupAllHostAddr based on preverIPv6). It would be good if instead of preferIPV6=true/false there would be a preferIPV6=true/false/donottouch, with donottouch beening the RFC 3484 compliant default.
I am talking about
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/272483f6650b/src/solaris/native/java/net/Inet6AddressImpl.c Line 140ff
According to RFC 3493 you should instead use the AI_ADDRCONFIG to automatically be sensitive to hosts stack configuration.
see discussion on net-dev mailing list
http://mail.openjdk.java.net/pipermail/net-dev/2013-June/006543.html