code: static Inet4Address anyInet4Address(final NetworkInterface interf) {
          return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() {
              public Inet4Address run() {
                  Enumeration<InetAddress> addrs = interf.getInetAddresses();
                  while (addrs.hasMoreElements()) {
                      InetAddress addr = addrs.nextElement();
                      if (addr instanceof Inet4Address) {
                          return (Inet4Address)addr;
                      }
                  }
                  return null;
              }
          });
      }
docs: Returns any IPv4 address of the given network interface, or
  null if the interface does not have any IPv4 addresses.