Here you can find the source of toShort(byte[] b, int pos)
public static short toShort(byte[] b, int pos)
//package com.java2s; public class Main { public static short toShort(byte[] b, int pos) { short ret = 0; ret |= (b[pos] & 0xFF);/*from w ww . j av a 2 s . c o m*/ ret |= (b[pos + 1] & 0xFF) << 8; return ret; } }