Java tutorial
//package com.java2s; public class Main { /** * Converts absolute command's byte array an argb color integer */ public static int bufferToInt(byte[] buffer, int size) { if (null == buffer || buffer.length != size) { throw new IllegalArgumentException("Buffer must be of size: " + size); } return (0xFF << 24) | (buffer[0] << 16) | (buffer[1] << 8) | buffer[2]; } }