@ Pure public static Collection < MACNumber > getAllAdapters ( ) { final List < MACNumber > av = new ArrayList <> ( ) ; final Enumeration < NetworkInterface > interfaces ; try { interfaces = NetworkInterface . getNetworkInterfaces ( ) ; } catch ( SocketException exception ) { return av ; } if ( interfaces != null ) { NetworkInterface inter ; while ( interfaces . hasMoreElements ( ) ) { inter = interfaces . nextElement ( ) ; try { final byte [ ] addr = inter . getHardwareAddress ( ) ; if ( addr != null ) { av . add ( new MACNumber ( addr ) ) ; } } catch ( SocketException exception ) { // Continue to the next loop. } } } return av ; }
Get all of the ethernet addresses associated with the local machine .