网上这段 获取Android ip地址的代码 没注释 看不懂 哪位高手能给小弟我解释下?多谢

网上这段 获取Android ip地址的代码 没注释 看不懂 谁能给我解释下?谢谢
public static String getLocalIpAddress() 
  { 
  try 
  { 
  for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) 
  { 
  NetworkInterface intf = en.nextElement(); 
  for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) 
  { 
  InetAddress inetAddress = enumIpAddr.nextElement(); 
  if (!inetAddress.isLoopbackAddress()) 
  { 
  return inetAddress.getHostAddress().toString(); 
  } 
  } 
  } 
  } 
  catch (SocketException ex) 
  { 
  Log.e("WifiPreference IpAddress", ex.toString()); 
  } 
  return null; 
  }

------解决方案--------------------
枚举网络接口,如果找到的不是回环(Loopback,127.0.0.1),就返回地址