mac address - How to filter virtual adapters mac addresses in java? -


i trying print mac addresses of machine on web app deployed. have seen many questions related mac addresses on so, couldn't solve issue. have tried far following code:

public static void main(string[] args) {     getmac(); }  public static void getmac() {     list<string> list = new arraylist<string>();     try {         enumeration<networkinterface> networks = networkinterface.getnetworkinterfaces();         while (networks.hasmoreelements()) {             networkinterface network = networks.nextelement();             byte[] mac = network.gethardwareaddress();              if (mac != null) {                 stringbuilder sb = new stringbuilder();                 (int = 0; < mac.length; i++) {                     sb.append(string.format("%02x%s", mac[i], (i < mac.length - 1) ? "-" : ""));                 }                 if (!(sb.length() == 0) && !list.contains(sb.tostring())) {                     if (!sb.tostring().equals("00-00-00-00-00-00-00-e0")) {                         list.add(sb.tostring());                     }                 }             }         }     } catch (socketexception e) {         e.printstacktrace();     }     system.out.println("mac adresses list = " + list); } 

the code lists network interface mac addresses including virtual adapters. want know if there way find out mac address of devices exist on machine. have seen this post not related java. want information uniquely identify computer(though there limitations approach).

what network.isvirtual() on networkinterface


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -