Here you can find the source of Bytes2Int16(byte[] sour, int offset)
public static int Bytes2Int16(byte[] sour, int offset)
//package com.java2s; public class Main { public static int Bytes2Int16(byte[] sour, int offset) { int ret = Bytes2Uint16(sour, offset); return ((ret & 0x8000) == 0x8000) ? 0xFFFF0000 | ret : ret; }// w w w . ja v a 2s .c o m public static int Bytes2Uint16(byte[] sour, int offset) { return (((sour[offset] << 8) & 0xFF00) | (sour[offset + 1] & 0x00FF)); } }