public static String getMacAddress(String host)  
    {  
        String mac = "";  
        StringBuffer sb = new StringBuffer();  
          
        try   
        {  
            NetworkInterface ni = NetworkInterface.getByInetAddress(InetAddress.getByName(host));  
              
            byte[] macs = ni.getHardwareAddress();  
              
            for(int i=0; i<macs.length; i++)  
            {  
                mac = Integer.toHexString(macs[i] & 0xFF);   
                  
                 if (mac.length() == 1)   
                 {   
                     mac = '0' + mac;   
                 }   
  
                sb.append(mac + "-");  
            }  
                          
        } catch (SocketException e) {  
            e.printStackTrace();  
        } catch (UnknownHostException e) {  
            e.printStackTrace();  
        }  
          
        mac = sb.toString();  
        mac = mac.substring(0, mac.length()-1);  
          
        return mac;  
    }