question: public static double calculateContrastRatio ( double lum1 , double lum2 ) { if ( ( lum1 < 0.0d ) || ( lum2 < 0.0d ) ) { throw new IllegalArgumentException ( "Luminance values may not be negative." ) ; } return ( Math . max ( lum1 , lum2 ) + 0.05d ) / ( Math . min ( lum1 , lum2 ) + 0.05d ) ; }
target:  Calculates the contrast ratio of two order-independent luminance values. <p> Derived from formula at http://gmazzocato.altervista.org/colorwheel/algo.php