Here you can find the source of toShort(byte[] key)
public static short toShort(byte[] key)
//package com.java2s; // BSD License (http://lemurproject.org/galago-license) public class Main { public static short toShort(byte[] key) { assert (key.length == 2); int value = ((key[0] << 8) + key[1]); return ((short) value); }//from w w w . j a va2 s . co m }