public static Inet4Address getIP4AsNeeded(Collection<InetAddress> hostAdresses){

		Inet4Address returnAddr = null; 

		Inet4Address globalAddr = null;
		Inet4Address siteLocalAddr = null;
		Inet4Address loopBackAddr = null;

		for (InetAddress inetAddress : hostAdresses) {
			if(inetAddress instanceof Inet4Address){
				Inet4Address inet4addr = (Inet4Address) inetAddress;
				if(isGlobalIP4(inet4addr)){
					globalAddr = inet4addr;
				}else if(inet4addr.isSiteLocalAddress()){
					siteLocalAddr = inet4addr;
				}else if(inet4addr.isLoopbackAddress()){
					loopBackAddr = inet4addr;
				}
			}
		}

		if(globalAddr != null){
			returnAddr = globalAddr;
		}else if(siteLocalAddr != null){
			returnAddr = siteLocalAddr;
		}else if(loopBackAddr != null){
			returnAddr = loopBackAddr;
		}
		return returnAddr;
	}