Here you can find the source of bytesToShort(byte[] bytes, int start)
public static short bytesToShort(byte[] bytes, int start)
//package com.java2s; //License from project: LGPL public class Main { public static short bytesToShort(byte[] bytes, int start) { short a = (short) (0xff & bytes[start + 0]); short b = (short) (0xff00 & (bytes[start + 1] << 8)); return (short) (a + b); }// ww w.j a va 2 s . c o m }