Guest User

Untitled

a guest
Jun 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public static void main(String[] args) throws SocketException {
  2. Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
  3. NetworkInterface inter;
  4. while (networks.hasMoreElements()) {
  5. inter = networks.nextElement();
  6. byte[] mac = inter.getHardwareAddress();
  7. if (mac != null) {
  8. for (int i = 0; i < mac.length; i++) {
  9. System.out.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "");
  10. }
  11. System.out.println("");
  12. }
  13. }
  14. }
Add Comment
Please, Sign In to add comment