Here you can find the source of bytesToUshort(byte first, byte second)
public static short bytesToUshort(byte first, byte second)
//package com.java2s; //License from project: Apache License public class Main { public static short bytesToUshort(byte first, byte second) { short value = (short) (((first & 0xFF) << 8) | (second & 0xFF)); return value; }//from w w w. ja va2 s . com }