public static int HSVtoRGB(float h, float s, float v) {
		// h,s,v in [0,1]
		float rr = 0, gg = 0, bb = 0;
		float hh = (6 * h) % 6;
		int c1 = (int) hh;
		float c2 = hh - c1;
		float x = (1 - s) * v;
		float y = (1 - (s * c2)) * v;
		float z = (1 - (s * (1 - c2))) * v;
		switch (c1) {
		case 0:
			rr = v;
			gg = z;
			bb = x;
			break;
		case 1:
			rr = y;
			gg = v;
			bb = x;
			break;
		case 2:
			rr = x;
			gg = v;
			bb = z;
			break;
		case 3:
			rr = x;
			gg = y;
			bb = v;
			break;
		case 4:
			rr = z;
			gg = x;
			bb = v;
			break;
		case 5:
			rr = v;
			gg = x;
			bb = y;
			break;
		}
		int N = 256;
		int r = Math.min(Math.round(rr * N), N - 1);
		int g = Math.min(Math.round(gg * N), N - 1);
		int b = Math.min(Math.round(bb * N), N - 1);
		int rgb = ((r & 0xff) << 16) | ((g & 0xff) << 8) | b & 0xff;
		return rgb;
	}