public static float hue(int color){
  int r=(color >> 16) & 0xFF;
  int g=(color >> 8) & 0xFF;
  int b=color & 0xFF;
  int V=Math.max(b,Math.max(r,g));
  int temp=Math.min(b,Math.min(r,g));
  float H;
  if (V == temp) {
    H=0;
  }
 else {
    final float vtemp=V - temp;
    final float cr=(V - r) / vtemp;
    final float cg=(V - g) / vtemp;
    final float cb=(V - b) / vtemp;
    if (r == V) {
      H=cb - cg;
    }
 else     if (g == V) {
      H=2 + cr - cb;
    }
 else {
      H=4 + cg - cr;
    }
    H/=6.f;
    if (H < 0) {
      H++;
    }
  }
  return H;
}

public static float hue ( int color ) { int r = ( color > > 16 ) & 0xFF ; int g = ( color > > 8 ) & 0xFF ; int b = color & 0xFF ; int V = Math . max ( b , Math . max ( r , g ) ) ; int temp = Math . min ( b , Math . min ( r , g ) ) ; float H ; if ( V == temp ) { H = 0 ; } else { final float vtemp = V - temp ; final float cr = ( V - r ) / vtemp ; final float cg = ( V - g ) / vtemp ; final float cb = ( V - b ) / vtemp ; if ( r == V ) { H = cb - cg ; } else if ( g == V ) { H = 2 + cr - cb ; } else { H = 4 + cg - cr ; } H /= 6.f ; if ( H < 0 ) { H ++ ; } } return H ; }
returns the hue component of a color int .
