Here you can find the source of bytes2uint(byte[] bytes, int from, int to)
public static int bytes2uint(byte[] bytes, int from, int to)
//package com.java2s; public class Main { public static int bytes2uint(byte[] bytes, int from, int to) { int result = 0; int len = to - from; for (int i = from; i < to; i++) { int shiftValue = (to - i - 1) * 8; result += (bytes[i] << shiftValue) & (0x0000FFFF >>> ((len - 1) * 8 - shiftValue)); }/* w ww . ja v a2 s . c o m*/ return result; } }