generate random mac address code example
Example: random mac address generator java
//package com.java2s;
import java.util.Random;
public class Main {
public static void main(String[] argv) throws Exception {
System.out.println(getRandomMacAddress());
}/* w w w .j ava 2 s . c om*/
public static String getRandomMacAddress() {
String mac = "";
Random r = new Random();
for (int i = 0; i < 6; i++) {
int n = r.nextInt(255);
mac += String.format("%02x", n);
}
return mac.toUpperCase();
}
}