Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws SocketException {
- Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
- NetworkInterface inter;
- while (networks.hasMoreElements()) {
- inter = networks.nextElement();
- byte[] mac = inter.getHardwareAddress();
- if (mac != null) {
- for (int i = 0; i < mac.length; i++) {
- System.out.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "");
- }
- System.out.println("");
- }
- }
- }
Add Comment
Please, Sign In to add comment