question: static double [ ] RGBtoHLS ( int rgb , double H , double L , double S ) { int colorR = ( rgb & 0x00FF0000 ) > > 16 ; int colorG = ( rgb & 0x0000FF00 ) > > 8 ; int colorB = rgb & 0x000000FF ; int n_cmax = Math . max ( colorR , Math . max ( colorG , colorB ) ) ; int n_cmin = Math . min ( colorR , Math . min ( colorG , colorB ) ) ; L = ( n_cmax + n_cmin ) / 2.0 / 255.0 ; if ( n_cmax == n_cmin ) { S = 0.0 ; H = 0.0 ; return new double [ ] { H , L , S } ; } double r = colorR / 255.0 , g = colorG / 255.0 , b = colorB / 255.0 , cmax = n_cmax / 255.0 , cmin = n_cmin / 255.0 , delta = cmax - cmin ; if ( L < 0.5 ) S = delta / ( cmax + cmin ) ; else S = delta / ( 2.0 - cmax - cmin ) ; if ( colorR == n_cmax ) H = ( g - b ) / delta ; else if ( colorG == n_cmax ) H = 2.0 + ( b - r ) / delta ; else H = 4.0 + ( r - g ) / delta ; H /= 6.0 ; if ( H < 0.0 ) H += 1.0 ; return new double [ ] { H , L , S } ; }
target:  RGB --> HLS \n prgb - address of 24bpp or 32bpp pixel.