Java Network Interface Get getMacBytes()

Here you can find the source of getMacBytes()

Description

get Mac Bytes

License

Apache License

Declaration

public static byte[] getMacBytes() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.net.InetAddress;
import java.net.NetworkInterface;

public class Main {
    public static byte[] getMacBytes() {
        try {/*  w w w  .ja v a2  s . co  m*/
            InetAddress ia = InetAddress.getLocalHost();
            return NetworkInterface.getByInetAddress(ia).getHardwareAddress();
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. getLocalNetworkInterface()
  2. getLoopbackInterface()
  3. getLoopbackInterfaceName()
  4. getLoopbackNIF()
  5. getMac()
  6. getNetworkErrorMessage(Throwable e)
  7. getNetworkInterface()
  8. getNetworkInterface()
  9. getNetworkInterface(String name)