Here you can find the source of bytes2Short(byte[] bytes)
public static short bytes2Short(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { public static short bytes2Short(byte[] bytes) { short val = 0; for (int i = 0; i < 2; i++) { val |= (0xFF & (short) bytes[i]) << (8 * i); }//w w w . ja va 2 s .c om return val; } }