18 lines
436 B
Java
18 lines
436 B
Java
package de.arminwolf.financeanalyzer.util;
|
|
|
|
import java.util.Random;
|
|
|
|
public class RandomColorUtil {
|
|
|
|
private static final Random random = new Random();
|
|
|
|
|
|
public static String getRandomColor() {
|
|
// create a big random number - maximum is ffffff (hex) = 16777215 (dez)
|
|
int nextInt = random.nextInt(0xffffff + 1);
|
|
|
|
// format it as hexadecimal string (with hashtag and leading zeros)
|
|
return String.format("#%06x", nextInt);
|
|
}
|
|
}
|