Random rnd = new Random();
int intVal = rnd.nextInt(16777215 + 1);
return Integer.toHexString(intVal);

or

return Integer.toString(intVal, 16);

16777215 == ffffff in decimal

References:

  1. http://www.paulirish.com/2009/random-hex-color-code-snippets/