public String getMacAddress()
{
StringBuilder macAddress = new StringBuilder(getRandomHex());
for (int i = 0; i < 5; i++)
macAddress.append(":").append(getRandomHex());
return macAddress.toString();
}
private String getRandomHex()
{
int random = (int) (Math.random() * 1000);
if (random > 255)
random %= 255;
String hex = Integer.toString(random, 16);
if (hex.length() == 1)
hex = "0" + hex;
return hex;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter