Java examples for 2D Graphics:Color RGB
get RGB Int
import java.awt.Color; public class Main{ public static void main(String[] argv) throws Exception{ int red = 2; int green = 2; int blue = 2; System.out.println(getRGBInt(red,green,blue)); }/* w ww .j ava 2s . co m*/ public static int getRGBInt(int red, int green, int blue, int alpha) { return ((alpha & 0xFF) << 24) | ((red & 0xFF) << 16) | ((green & 0xFF) << 8) | (blue & 0xFF); } public static int getRGBInt(int red, int green, int blue) { final int alpha = 255; return ColourUtils.getRGBInt(red, green, blue, alpha); } }