question: private static float [ ] rgbToHLS ( int rgb , float [ ] hls ) { float r = ( ( rgb & 0xFF0000 ) > > 16 ) / 255.0f ; float g = ( ( rgb & 0xFF00 ) > > 8 ) / 255.0f ; float b = ( rgb & 0xFF ) / 255.0f ; float max = Math . max ( Math . max ( r , g ) , b ) ; float min = Math . min ( Math . min ( r , g ) , b ) ; float l = ( max + min ) / 2.0f ; float s = 0 ; float h = 0 ; if ( max != min ) { float delta = max - min ; s = ( l <= .5f ) ? ( delta / ( max + min ) ) : ( delta / ( 2.0f - max - min ) ) ; if ( r == max ) { h = ( g - b ) / delta ; } else if ( g == max ) { h = 2.0f + ( b - r ) / delta ; } else { h = 4.0f + ( r - g ) / delta ; } h *= 60.0f ; if ( h < 0 ) { h += 360.0f ; } } if ( hls == null ) { hls = new float [ 3 ] ; } hls [ 0 ] = h ; hls [ 1 ] = l ; hls [ 2 ] = s ; return hls ; }
target:  Converts from RGB color space to HLS colorspace.