Here you can find the source of rgb8ToPixel(byte[] nrgb)
public static int rgb8ToPixel(byte[] nrgb)
//package com.java2s; /*/*from ww w. ja v a 2 s . com*/ ColorMapUtils.java (c) 2011-2013 Edward Swartz All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html */ public class Main { public static int rgb8ToPixel(byte[] nrgb) { return ((nrgb[0] & 0xff) << 16) | ((nrgb[1] & 0xff) << 8) | (nrgb[2] & 0xff); } public static int rgb8ToPixel(int[] prgb) { return (Math.max(0, Math.min(prgb[0], 255)) << 16) | (Math.max(0, Math.min(prgb[1], 255)) << 8) | Math.max(0, Math.min(prgb[2], 255)); } }