Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { /** * Create a random string hex color. * @return string hex color */ public static String randomHex() { Random rnd = new Random(); return String.format("#%02X%02X%02X", rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)); } }