code: public static ResolvedAddressTypes computeResolvedAddressTypes(InternetProtocolFamily... internetProtocolFamilies) {
          if (internetProtocolFamilies == null || internetProtocolFamilies.length == 0) {
              return DnsNameResolver.DEFAULT_RESOLVE_ADDRESS_TYPES;
          }
          if (internetProtocolFamilies.length > 2) {
              throw new IllegalArgumentException("No more than 2 InternetProtocolFamilies");
          }
  
          switch(internetProtocolFamilies[0]) {
              case IPv4:
                  return (internetProtocolFamilies.length >= 2
                          && internetProtocolFamilies[1] == InternetProtocolFamily.IPv6) ?
                          ResolvedAddressTypes.IPV4_PREFERRED: ResolvedAddressTypes.IPV4_ONLY;
              case IPv6:
                  return (internetProtocolFamilies.length >= 2
                          && internetProtocolFamilies[1] == InternetProtocolFamily.IPv4) ?
                          ResolvedAddressTypes.IPV6_PREFERRED: ResolvedAddressTypes.IPV6_ONLY;
              default:
                  throw new IllegalArgumentException(
                          "Couldn't resolve ResolvedAddressTypes from InternetProtocolFamily array");
          }
      }
docs: Compute a {@link ResolvedAddressTypes} from some {@link InternetProtocolFamily}s.
  An empty input will return the default value, based on "java.net" System properties.
  Valid inputs are (), (IPv4), (IPv6), (Ipv4, IPv6) and (IPv6, IPv4).
  @param internetProtocolFamilies a valid sequence of {@link InternetProtocolFamily}s
  @return a {@link ResolvedAddressTypes}