Here you can find the source of getInterfaces()
public static Map<String, String> getInterfaces()
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getInterfaces() { Map<String, String> interfaces = new HashMap<String, String>(); try {/*from www. ja va2 s. c o m*/ Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) e.nextElement(); String nameInterface = ni.getName(); Enumeration<InetAddress> e2 = ni.getInetAddresses(); while (e2.hasMoreElements()) { InetAddress ipAddr = (InetAddress) e2.nextElement(); if (ipAddr.getHostAddress().contains(".")) { String ip = ipAddr.getHostAddress(); interfaces.put(nameInterface, ip); } } } } catch (Exception e) { e.printStackTrace(); } return interfaces; } }