Here you can find the source of toInt(final byte[] pBytes)
Parameter | Description |
---|---|
pBytes | a byte array of length 4 |
Parameter | Description |
---|---|
ArrayIndexOutOfBoundsException | if length is < 4 |
static int toInt(final byte[] pBytes)
//package com.java2s; public class Main { /**// w w w. ja v a 2 s. com * Converts a byte array to an int. * * @param pBytes a byte array of length 4 * @return the bytes converted to an int * * @throws ArrayIndexOutOfBoundsException if length is < 4 */ static int toInt(final byte[] pBytes) { return (pBytes[0] & 0xff) << 24 | (pBytes[1] & 0xff) << 16 | (pBytes[2] & 0xff) << 8 | (pBytes[3] & 0xff); } }