Hallo!

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 /**
  * 
  */
 package de.tutorials.mustang;
 
 import java.net.NetworkInterface;
 import java.net.SocketException;
 import java.util.Enumeration;
 
 /**
  * @author Tom
  * 
  */
 public class MustangAPIShowMacAdressExample {
 
    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            Enumeration<NetworkInterface> enumeration = NetworkInterface
                    .getNetworkInterfaces();
            while (enumeration.hasMoreElements()) {
                NetworkInterface networkInterface = enumeration.nextElement();
                System.out.println(networkInterface.getDisplayName());
                byte[] macAddress = networkInterface.getHardwareAddress();
                if (macAddress == null) {
                    continue;
                }
                System.out.println("Mac Address: ");
                System.out.printf(
                        "%1$02x-%2$02x-%3$02x-%4$02x-%5$02x-%6$02x\n",
                        macAddress[0], macAddress[1], macAddress[2],
                        macAddress[3], macAddress[4], macAddress[5]);
 
            }
        } catch (SocketException e) {
            e.printStackTrace();
        }
    }
 }

Gruß Tom