Check out example codes for "random mac address generator java". It will help you in understanding the concepts better.

Code Example 1

//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();
    }
}

Learn ReactJs, React Native from akashmittal.com