Here you can find the source of toInt(byte[] buf, int pos)
public static int toInt(byte[] buf, int pos)
//package com.java2s; //License from project: Apache License public class Main { public static int toInt(byte[] buf, int pos) { return toUnsignedByte(buf, pos) << 24 + toUnsignedByte(buf, pos + 1) << 16 + toUnsignedByte(buf, pos + 2) << 8 + toUnsignedByte(buf, pos + 3); }//from ww w .ja v a 2s. co m public static int toUnsignedByte(byte[] buf, int pos) { int b = buf[pos]; if (b < 0) { b = 256 + b; } return b; } }