public static int hsvToRgb(float hue, float saturation, float value) {
		while (hue < 0) hue++;
		int h = (int)(hue * 6) % 6;
		float f = hue * 6 - h;
		float p = value * (1 - saturation);
		float q = value * (1 - f * saturation);
		float t = value * (1 - (1 - f) * saturation);

		switch (h) {
		case 0: return rgbFloatToInt(value, t, p);
		case 1: return rgbFloatToInt(q, value, p);
		case 2: return rgbFloatToInt(p, value, t);
		case 3: return rgbFloatToInt(p, q, value);
		case 4: return rgbFloatToInt(t, p, value);
		case 5: return rgbFloatToInt(value, p, q);
		default: throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + hue + ", " + saturation + ", " + value);
		}
	}