Here you can find the source of toShort(byte[] value)
Parameter | Description |
---|---|
value | a parameter |
public static short toShort(byte[] value)
//package com.java2s; //License from project: Open Source License public class Main { /**// ww w.j a v a 2 s . co m * byte[] -> short * * @param value * @return */ public static short toShort(byte[] value) { if (value == null || value.length != 2) { return 0x0; } return (short) ((0xff & value[0]) << 8 | (0xff & value[1]) << 0); } }