Read a four byte integer.

@param data byte array
@param offset offset into array
@return integer value
511274
public static final int getInt(byte[] data, int offset)
   {
      int result = 0;
      int i = offset;
      for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
      {
         result |= ((data[i] & 0xff)) << shiftBy;
         ++i;
      }
      return result;
   }
552387
public int read(long offset) throws IOException {
    int b;
    if (maxBufferSize <= 0) {
      // old-school (no buffer optimization)
      b = input.read();
    } else {
      checkBuffer(offset);
      b = buffer[(int) (offset - bufferOffset)];
    }
    if (b < 0) return 256+b;
    return b;
  }
1354135
protected final void slicingBy4 (final int data) {

        crc ^= Integer.reverseBytes(data);

        final int term1 = CRC_TABLE_56[crc & FOURTH_BYTE_MASK] ^ CRC_TABLE_48[(crc >>> ONE_BYTE_SHIFT) & FOURTH_BYTE_MASK];
        final int term2 = crc >>> TWO_BYTES_SHIFT;
        crc = term1 ^ CRC_TABLE_40[term2 & FOURTH_BYTE_MASK] ^ CRC_TABLE_32[(term2 >>> ONE_BYTE_SHIFT) & FOURTH_BYTE_MASK];
    }
1208175
public void readBytes (byte[] bytes, int offset, int count) throws KryoException {
		if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
		int copyCount = Math.min(limit - position, count);
		while (true) {
			System.arraycopy(buffer, position, bytes, offset, copyCount);
			position += copyCount;
			count -= copyCount;
			if (count == 0) break;
			offset += copyCount;
			copyCount = Math.min(count, capacity);
			require(copyCount);
		}
	}
611808
public static int readInt(byte b[], int offset) {
    int retValue;

    retValue = ((int)b[offset++]) << 24;
    retValue |= ((int)b[offset++] & 0xff) << 16;
    retValue |= ((int)b[offset++] & 0xff) << 8;
    retValue |= (int)b[offset] & 0xff;

    return retValue;
  }
698708
protected final int readBytesAt(int offset)
        throws IOException
    {
        // shouldn't modify mBytePtr, assumed to be 'offset'
        if (mIn != null) {
            int count = mIn.read(mByteBuffer, offset, mByteBuffer.length - offset);
            if (count > 0) {
                mByteBufferEnd += count;
            }
            return count;
        }
        return -1;
    }
715925
public static long readInt(byte[] data, int start) {
		long ret = (((long) (data[start] & 0xFF) << 24) & 0xFFFFFFFFL)
				| ((data[start + 1] & 0xFF) << 16)
				| ((data[start + 2] & 0xFF) << 8)
				| ((data[start + 3] & 0xFF) << 0);

		return ret;
	}
1063380
@Override
    public Float fromBytes(Class targetClass, byte[] data)
    {
        if (data == null || data.length != 4)
            return (float) 0x0;

        return Float.intBitsToFloat(toInt(data));
    }
388946
public static long bytes(byte[] data, int offset, int length) {
        CRC32 crc32 = new CRC32();
        crc32.update(data, offset, length);
        return crc32.getValue();
    }
1155441
public static int byteArrayToIntLE( byte[] data ) {
        ByteBuffer buffer = ByteBuffer.wrap(data);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        return buffer.getInt();
    }
727327
@Override
  public int read(byte []buf, int offset, int length)
    throws IOException
  {
    if (buf == null)
      throw new NullPointerException();
    else if (offset < 0 || buf.length < offset + length)
      throw new ArrayIndexOutOfBoundsException();

    int result = nativeRead(_fd, buf, offset, length);

    if (result > 0)
      _pos += result;

    return result;
  }
906762
public static int bitCount(final byte[] data) {
        int count = 0;
        for (final byte element : data) {
            byte bits = element;
            for (int j = 0; j < 8; j++) {
                if ((bits & 1) == 1) {
                    count++;
                }
                bits >>= 1;
            }
        }
        return count;
    }
449958
public static long readBytes(byte[] bytes, int offset, int numBytes) {
        int shift = 0;
        long value = 0;
        for(int i = offset + numBytes - 1; i >= offset; i--) {
            value |= (bytes[i] & 0xFFL) << shift;
            shift += 8;
        }
        return value;
    }
471061
public static final int getShort(byte[] data, int offset)
   {
      int result = 0;
      int i = offset;
      for (int shiftBy = 0; shiftBy < 16; shiftBy += 8)
      {
         result |= ((data[i] & 0xff)) << shiftBy;
         ++i;
      }
      return result;
   }
611010
public synchronized int read(int plane, byte data[], int offset, int length) throws IOException {
		if (offset < 0 || length < 0 || length > data.length - offset)
			throw new IndexOutOfBoundsException();

		if (bytesToRead[plane] == 0)
			return 0;

		if (bytesToRead[plane] < length)
			length = bytesToRead[plane];

		buffer[plane].position(readPointer[plane]);
		int partLength = buffer[plane].capacity() - readPointer[plane];

		if (partLength > length) {
			buffer[plane].get(data, offset, length);
			readPointer[plane] += length;
		}
		else {
			buffer[plane].get(data, offset, partLength);
			buffer[plane].position(0);
			buffer[plane].get(data, partLength, length - partLength);
			readPointer[plane] = length - partLength;
		}

		bytesToRead[plane] -= length;
		bytesToWrite[plane] += length;

		return length;
	}
515978
public synchronized int read(byte[] buf, int offset, int length) 
        throws IOException
    {

        if (!waitForContent())
            return -1;
            
         if (length>_buffer.remaining())
            length=_buffer.remaining();
            
         _buffer.get(buf, offset, length);
        return length;
    }
1029191
public static int readInt(byte[] bytes, int offset) {
        return (((bytes[offset + 0] & 0xff) << 24) | ((bytes[offset + 1] & 0xff) << 16)
                | ((bytes[offset + 2] & 0xff) << 8) | (bytes[offset + 3] & 0xff));
    }