title: java printing ethernet mac address
body: <p>Hi im trying to print the Ethernet mac address of a computer but im unsure how to change my code from printing the wireless lan address i couldn't find any information on google.</p>
  
  <pre><code>public void getMacAddress(){
      InetAddress ip;
      try {
          ip = InetAddress.getLocalHost();
          NetworkInterface network = NetworkInterface.getByInetAddress(ip);
          byte[] mac = network.getHardwareAddress();
          System.out.print("Current MAC address : ");
          StringBuilder sb = new StringBuilder();
          for (int i = 0; i &lt; mac.length; i++) {
              sb.append(String.format("%02X%s", mac[i], (i &lt; mac.length - 1) ? "-" : ""));        
          }
          System.out.println(sb.toString());
      } catch (UnknownHostException e) {
          e.printStackTrace();
      } catch (SocketException e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>im looking to print the Ethernet adapter Local Area Connection: instead of the
  Wireless LAN adapter Wireless Network Connection 3:</p>