int color = Color.parseColor("#FF0000"); // red color float[] hsv = new float[3]; // initialize an array to hold the HSV values Color.colorToHSV(color, hsv); // convert the color to HSV and store the values in the array
int color = Color.rgb(255, 255, 0); // yellow color float[] hsv = new float[3]; Color.colorToHSV(color, hsv);In this example, we define the yellow color in the RGB color space using the Color.rgb() method, which takes separate int values for the red, green, and blue components. We then follow the same process as in the first example to convert the color to the HSV color space and store the resulting values in the hsv array.