Here you can find the source of bytesToInt(byte[] buff, int off, int len)
public static int bytesToInt(byte[] buff, int off, int len)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { /**/* w ww . j av a 2s . c om*/ * Utility methods for working with bytes and byte buffers */ public static int bytesToInt(byte[] buff, int off, int len) { int num = 0; int shift = 0; for (int i = off + len - 1; i >= off; i--) { num += (buff[i] & 0xFF) << shift; shift += 8; } return num; } }