code: private void RGBtoHSV(float red, float green, float blue) {
  
          float min = 0;
          float max = 0;
          float delta = 0;
  
          min = MIN(red, green, blue);
          max = MAX(red, green, blue);
  
          m_bri = max; // v
  
          delta = max - min;
  
          if (max != 0) {
              m_sat = delta / max; // s
          } else {
              m_sat = 0;
              m_hue = 0;
              return;
          }
  
          if (delta == 0) {
              m_hue = 0;
              return;
          }
  
          if (red == max) {
              m_hue = (green - blue) / delta;
          } else if (green == max) {
              m_hue = 2 + ((blue - red) / delta);
          } else {
              m_hue = 4 + ((red - green) / delta);
          }
  
          m_hue *= 60;
  
          if (m_hue < 0) {
              m_hue += 360;
          }
      }
docs: Converts the RGB into the HSV.<p>
  @param red value
  @param green value
  @param blue value