I figured I should post this question, even if I have already found a solution, as a Java implementation was not readily available when I searched for it.
Using HSV instead of RGB allows the generation of colors with the same saturation and brightness (something I wanted).
Google App Engine does not allow use of java.awt.Color, so doing the following to convert between HSV and RGB is not an option:
Color c = Color.getHSBColor(hue, saturation, value);
String rgb = Integer.toHexString(c.getRGB());
Edit: I moved my answer as described in the comment by Nick Johnson.
Ex animo, – Alexander.
I don’t know anything about color math, but I can offer this alternative structure for the code, which tickles my aesthetic sense because it made it obvious to me how each of the 6 cases is just a different permutation of value, t and p. (Also I have an irrational fear of long if-else chains.)