Generar color hexadecimal aleatorio en java.

/** *Ingeniero Luis T. */ public static void main(String[] args) { generateRandomColor(); } private static String generateRandomColor(){ String[] letters = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; String color = "#"; for (int i = 0; i < 6; i++ ) { color += letters[(int) Math.round(Math.random() * 15)]; } return color; }
Método que permite crear colores hexadecimales dinámicamente.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.