public class MacAddressUtil extends Object
Constructor and Description |
---|
MacAddressUtil() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
getHardwareAddress(InetAddress inetAddress)
获得指定地址信息中的硬件地址(MAC地址)
|
static String |
getMacAddress(InetAddress inetAddress)
获得指定地址信息中的MAC地址,使用分隔符“-”
|
static String |
getMacAddress(InetAddress inetAddress,
String separator)
获得指定地址信息中的MAC地址
|
static String |
toMacAddressStr(byte[] mac,
String separator)
将bytes类型的mac地址转换为可读字符串,通常地址每个byte位使用16进制表示,并用指定分隔符分隔
|
public static String getMacAddress(InetAddress inetAddress)
inetAddress
- InetAddress
public static String getMacAddress(InetAddress inetAddress, String separator)
inetAddress
- InetAddress
separator
- 分隔符,推荐使用“-”或者“:”public static byte[] getHardwareAddress(InetAddress inetAddress)
inetAddress
- InetAddress
Copyright © 2025. All rights reserved.