Here you can find the source of bytes2short(byte[] data)
public static short bytes2short(byte[] data)
//package com.java2s; public class Main { public static short bytes2short(byte[] data) { short val = 0; val |= data[0] & 0x00FF; val |= data[1] << 8; return val; }/*w ww . j a v a2 s . com*/ }