Here you can find the source of getMacAddress()
public static byte[] getMacAddress()
//package com.java2s; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; public class Main { private static byte[] cachedMacAddress; /**//from w w w . j av a2 s. c o m * Grabs the mac address of computer and makes it 10 times longer * * @return a byte array containing mac address */ public static byte[] getMacAddress() { if (cachedMacAddress != null && cachedMacAddress.length >= 10) { return cachedMacAddress; } try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface network = networkInterfaces.nextElement(); byte[] mac = network.getHardwareAddress(); if (mac != null && mac.length > 0) { cachedMacAddress = new byte[mac.length * 10]; for (int i = 0; i < cachedMacAddress.length; i++) { cachedMacAddress[i] = mac[i - (Math.round(i / mac.length) * mac.length)]; } return cachedMacAddress; } } } catch (SocketException ignored) { } return new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; } }