Java tutorial
//package com.java2s; //License from project: Apache License public class Main { /** * Returns the brightness component of a color int. * * @return A value between 0.0f and 1.0f * * @hide Pending API council */ public static float brightness(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)); return (V / 255.f); } }