this an example to get mac address form my machine but i can't understand the syntax of sting.format function here is the example.
public String getMACIdentifier(NetworkInterface network)
{
StringBuilder identifier = new StringBuilder();
try {
byte[] macBuffer = network.getHardwareAddress();
if (macBuffer != null) {
for (int i = 0; i < macBuffer.length; i++) {
identifier.append(
String.format("%02X%s",macBuffer[i],
(i < macBuffer.length - 1) ? "-" : ""));
}
} else {
return "---";
}
} catch (SocketException ex) {
ex.printStackTrace();
}
return identifier.toString();
}