Here you can find the source of multiply(int a, int b)
public static int multiply(int a, int b)
//package com.java2s; //License from project: LGPL public class Main { public static int multiply(int a, int b) { int ar = getRed(a); int ag = getGreen(a); int ab = getBlue(a); ar *= getRed(b);//from w w w. j a v a 2 s . com ag *= getGreen(b); ab *= getBlue(b); return getRGB(clamp(ar), clamp(ag), clamp(ab)); } public static int getRed(int rgb) { return (rgb >> 16) & 0xFF; } public static int getGreen(int rgb) { return (rgb >> 8) & 0xFF; } public static int getBlue(int rgb) { return rgb & 0xFF; } public static int getRGB(int red, int green, int blue) { int alpha = 0xff; int rgb = alpha; rgb = (rgb << 8) + red; rgb = (rgb << 8) + green; rgb = (rgb << 8) + blue; return rgb; } public static int clamp(int a) { if (a < 0) { return 0; } else if (a > 0xff) { return 0xff; } return a; } public static double clamp(double a) { if (a < 0) { return 0; } else if (a > 0xff) { return 0xff; } return a; } }