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; }