Here you can find the source of bytes2short(byte[] b)
Parameter | Description |
---|---|
b | byte array. |
public static short bytes2short(byte[] b)
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww . ja va 2 s. c o m*/ * to short. * * @param b byte array. * @return short. */ public static short bytes2short(byte[] b) { return bytes2short(b, 0); } /** * to short. * * @param b byte array. * @param off offset. * @return short. */ public static short bytes2short(byte[] b, int off) { return (short) (((b[off + 1] & 0xFF) << 0) + ((b[off + 0]) << 8)); } }