Take a look at YCbCr. Since Java and most computer processes colors in RGB format, you will need to do some conversion from RGB to YCbCr. There are many formulas to convert RGB to YCbCr.
Once you get the YCbCr value, you can check the luminance value (the value Y in YCbCr).