private static int convertLinearRGBtoSRGB(int color){
  float input, output;
  input=color / 255.0f;
  if (input <= 0.0031308) {
    output=input * 12.92f;
  }
 else {
    output=(1.055f * ((float)Math.pow(input,(1.0 / 2.4)))) - 0.055f;
  }
  return Math.round(output * 255.0f);
}

private static int convertLinearRGBtoSRGB ( int color ) { float input , output ; input = color / 255.0f ; if ( input <= 0.0031308 ) { output = input * 12.92f ; } else { output = ( 1.055f * ( ( float ) Math . pow ( input , ( 1.0 / 2.4 ) ) ) ) - 0.055f ; } return Math . round ( output * 255.0f ) ; }
helper function to convert a color component in linear rgb space to srgb space . used to build a static lookup table .
