Here you can find the source of toShort(byte[] b)
public static short toShort(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { public static short toShort(byte[] b) { return toShort(b, 0); }/*from w w w.ja v a2s. c o m*/ public static short toShort(byte[] b, int off) { return (short) (((b[off + 1] & 0xFF) << 0) + ((b[off + 0] & 0xFF) << 8)); } }