Here you can find the source of RGBAtoI(byte r, byte g, byte b, byte a)
public static int RGBAtoI(byte r, byte g, byte b, byte a)
//package com.java2s; /*//from w w w . jav a 2 s . c o m * @(#)gl_util.java 0.3 06/11/20 * * jGL 3-D graphics library for Java * Copyright (c) 1999-2006 Robin Bing-Yu Chen (robin@ntu.edu.tw) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. the GNU Lesser * General Public License should be included with this distribution * in the file LICENSE. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ public class Main { public static int RGBAtoI(byte r, byte g, byte b, byte a) { return (((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | b); } public static int RGBAtoI(int r, int g, int b, int a) { return ((a << 24) | (r << 16) | (g << 8) | b); } public static int RGBAtoI(float r, float g, float b, float a) { return RGBAtoI(FtoI(r), FtoI(g), FtoI(b), FtoI(a)); } public static int FtoI(float x) { return (int) (x * 255.0f); } }