Here you can find the source of toInt(final byte[] data)
Parameter | Description |
---|---|
data | 4-byte array in big-endian format. |
public static int toInt(final byte[] data)
//package com.java2s; /* See LICENSE for licensing and NOTICE for copyright. */ public class Main { /**/*ww w. ja va2 s .com*/ * Converts the big-endian representation of a 32-bit integer to the * equivalent integer value. * * @param data 4-byte array in big-endian format. * * @return Long integer value. */ public static int toInt(final byte[] data) { return (data[0] << 24) | ((data[1] & 0xff) << 16) | ((data[2] & 0xff) << 8) | (data[3] & 0xff); } }