Here you can find the source of byteArrayToShort(byte[] value, int offset)
public static final short byteArrayToShort(byte[] value, int offset)
//package com.java2s; public class Main { public static final short byteArrayToShort(byte[] value, int offset) { return (short) ((((short) value[0 + offset] << 8) & 0xFF00) | ((short) value[1 + offset] & 0x00FF)); }//from w ww. j a va 2 s. c o m }