Here you can find the source of printInterface(NetworkInterface netIf)
private static void printInterface(NetworkInterface netIf) throws SocketException
//package com.java2s; //License from project: Open Source License import java.net.*; import java.util.Collections; import java.util.Enumeration; import static java.lang.System.out; public class Main { private static void printInterface(NetworkInterface netIf) throws SocketException { out.printf("Display name: %s\n", netIf.getDisplayName()); out.printf("Name: %s\n", netIf.getName()); displaySubInterfaces(netIf);/* w w w .j a va2s . c o m*/ out.printf("\n"); } private static void displaySubInterfaces(NetworkInterface netIf) throws SocketException { Enumeration<NetworkInterface> subIfs = netIf.getSubInterfaces(); for (NetworkInterface subIf : Collections.list(subIfs)) { out.printf("\tSub Interface Display name: %s\n", subIf.getDisplayName()); out.printf("\tSub Interface Name: %s\n", subIf.getName()); } } }