Many motherboards have an integrated network adapter. I need to get mac address from this device if exists. From Network adapter:
private void getMacFromInetAddress(){
try {
Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
while (networks.hasMoreElements()) {
NetworkInterface network = networks.nextElement();
byte[] mac = network.getHardwareAddress();
if (mac != null) {
System.out.print("Current MAC address : ");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mac.length; i++) {
sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
}
}
}
} catch (UnknownHostException | SocketException e) {
System.out.println(e.getLocalizedMessage());
}
}
how to get specify the name of a integrated network adapter from this code?