Here you can find the source of bytesToInt(byte[] bytes, int offset, int length)
private static int bytesToInt(byte[] bytes, int offset, int length)
//package com.java2s; /**/*from w ww . j av a2 s.c o m*/ * Copyright (c) 2010-2015, openHAB.org and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ public class Main { private static int bytesToInt(byte[] bytes, int offset, int length) { int value = 0; for (int i = 0; i < length; i++) { value |= ((int) (bytes[offset + i] & 0xff) << (8 * i)); } return value; } }