Here you can find the source of getInterfaces()
private static List<NetworkInterface> getInterfaces() throws SocketException
//package com.java2s; //License from project: Apache License import java.net.NetworkInterface; import java.net.SocketException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; public class Main { private static List<NetworkInterface> getInterfaces() throws SocketException { Enumeration<NetworkInterface> intfs = NetworkInterface.getNetworkInterfaces(); List<NetworkInterface> intfsList = new ArrayList<NetworkInterface>(); while (intfs.hasMoreElements()) { intfsList.add((NetworkInterface) intfs.nextElement()); }/*from www .jav a2 s . c om*/ return intfsList; } }