Here you can find the source of hsvToRgb(float h, float s, float v, int[] rgb)
public static void hsvToRgb(float h, float s, float v, int[] rgb)
//package com.java2s; /*/* ww w . j a va 2 s . c om*/ ColorMapUtils.java (c) 2011-2013 Edward Swartz All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html */ public class Main { public static void hsvToRgb(float h, float s, float v, int[] rgb) { float c = (Math.max(0f, Math.min(360f, v) / 256)) * Math.max(0f, Math.min(1f, s)); float hprime = (Math.max(0f, Math.min(256f, h)) / 60); float x = c * (1 - Math.abs(hprime % 2 - 1)); float fr, fg, fb; switch ((int) hprime) { case 0: fr = c; fg = x; fb = 0; break; case 1: fr = x; fg = c; fb = 0; break; case 2: fr = 0; fg = c; fb = x; break; case 3: fr = 0; fg = x; fb = c; break; case 4: fr = x; fg = 0; fb = c; break; case 5: fr = c; fg = 0; fb = x; break; default: fr = fg = fb = 0; } float m = (Math.max(0f, Math.min(256f, v)) / 256) - c; rgb[0] = (int) ((fr + m) * 255); rgb[1] = (int) ((fg + m) * 255); rgb[2] = (int) ((fb + m) * 255); } }