import java.net.NetworkInterface;
public class Test {
public static void main(String[] args) throws Exception {
NetworkInterface ni = NetworkInterface.getByName("eth0");
byte[] b = ni.getHardwareAddress();
System.out.printf("MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", b[0], b[1],
b[2], b[3], b[4], b[5]);
}
}