code: public static InetAddress getLocalIpAddress(String iface) throws RuntimeException
  	{
  		try
  		{
  			NetworkInterface nic = NetworkInterface.getByName(iface);
  
  			Enumeration<InetAddress> ips = nic.getInetAddresses();
  
  			InetAddress firstIP = null;
  			while (ips != null && ips.hasMoreElements())
  			{
  				InetAddress ip = ips.nextElement();
  				if (firstIP == null)
  					firstIP = ip;
  
  				if (log.isDebugEnabled())
  					log.debug("[IpHelper] {getLocalIpAddress} Considering locality: " + ip.getHostAddress());
  
  				if (!ip.isAnyLocalAddress())
  				{
  					return ip;
  				}
  			}
  
  			// Return the first IP (or null if no IPs were returned)
  			return firstIP;
  		}
  		catch (SocketException e)
  		{
  			throw new RuntimeException("[IpHelper] {getLocalIpAddress}: Unable to acquire an IP", e);
  		}
  	}
docs: Returns the IP address associated with iface
  
  @param iface
  The interface name
  
  @return InetAddress The InetAddress of the interface (or null if none found)
  
  @throws RuntimeException
  On any error
  @since 1.0