public static int multiplyOpacities256(int opacity1,int opacity2){
  double op1=opacity1 / 255.0;
  double op2=opacity2 / 255.0;
  double resultOpacity=op1 * op2;
  return (int)Math.round(resultOpacity * 255.0);
}

public static int multiplyOpacities256 ( int opacity1 , int opacity2 ) { double op1 = opacity1 / 255.0 ; double op2 = opacity2 / 255.0 ; double resultOpacity = op1 * op2 ; return ( int ) Math . round ( resultOpacity * 255.0 ) ; }
multiplies two opacities with range [ 0 , 255 ] . first maps both values to [ 0 , 1 ] , then calculates the product and maps the result back to [ 0 , 255 ] .
