Here you can find the source of byte2short(byte[] value, int offset)
public static short byte2short(byte[] value, int offset)
//package com.java2s; //License from project: Apache License public class Main { public static short byte2short(byte[] value, int offset) { long result = (((long) (value[0 + offset]) & 0xFF) << 8) | ((long) (value[1 + offset]) & 0xFF); return (short) (result & 0xFFFFL); }//w ww. j a va 2 s . com }