Here you can find the source of bytesToInt(byte[] bytes)
public static int bytesToInt(byte[] bytes)
//package com.java2s; /*/*from w ww. ja v a 2 s. c o m*/ * Copyright 2001-2013 Geert Bevin (gbevin[remove] at uwyn dot com) * Licensed under the Apache License, Version 2.0 (the "License") */ public class Main { public static int bytesToInt(byte[] bytes) { int q3 = bytes[3] << 24; int q2 = bytes[2] << 16; int q1 = bytes[1] << 8; int q0 = bytes[0]; if (q2 < 0) q2 += 16777216; if (q1 < 0) q1 += 65536; if (q0 < 0) q0 += 256; return q3 | q2 | q1 | q0; } }