Here you can find the source of getIPs()
public static String getIPs()
//package com.java2s; import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration; public class Main { public static String getIPs() { String ipaddress = ""; try {//from w ww . j a v a2s .c om 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()) { ipaddress += inetAddress.getHostAddress() .toString() + ";"; } } } } catch (Exception ex) { ex.printStackTrace(); } return ipaddress; } }