Here you can find the source of byte2short(byte[] data)
public static final short byte2short(byte[] data)
//package com.java2s; public class Main { public static final short byte2short(byte[] data) { if (data != null && data.length == 2) { return (short) (((data[1] & 0xff) << 8) + (data[0] & 0xff)); }// www. ja v a2 s. c o m return 0; } }