### Get the MAC Address

To get the MAC address, use various JavaObjects and convert the result into Array of Bytes, which
is then converted into a Hex String.
Example
' Get the MAC address
' Return MAC address in hexformat
`Sub getMACAddress As String
' Get the localhost
Dim JO As JavaObject
JO.InitializeStatic("java.net.InetAddress")
Dim objLocalHost As Object = JO.RunMethod("getLocalHost", Null)
' Get the network adress from the localhost
Dim JO3 As JavaObject
JO3.InitializeStatic("java.net.NetworkInterface")
Dim JO4 As JavaObject = JO3.RunMethod("getByInetAddress", Array As Object(objLocalHost))
' Obtain the hardware address from the network address in an array of bytes
Dim hwa() As Byte = JO4.RunMethod("getHardwareAddress", Null)
' Convert the array of bytes in a hex string
Dim bc As ByteConverter
Dim sb As StringBuilder
sb.Initialize
sb.Append(bc.HexFromBytes(hwa))
sb.Insert(2, "-").Insert(5,"-").Insert(8, "-").Insert(11, "-").Insert(14, "-")
Log("HardwareAddress:" & sb.ToString)
Return sb.ToString
End Sub`

Changed: , Category: Network, File: T6C224M1656.htm, ID: 1656