Java Short Number Create toShort(byte[] value)

Here you can find the source of toShort(byte[] value)

Description

byte[] -> short

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static short toShort(byte[] value) 

Method Source Code

//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);
    }
}

Related

  1. toShort(byte[] input)
  2. toShort(byte[] key)
  3. toShort(byte[] readBuffer, int o)
  4. toShort(byte[] si, boolean isReverseOrder)
  5. toShort(byte[] src)
  6. toShort(char[] bytes, boolean le)
  7. toShort(final byte[] b)
  8. toShort(final byte[] b)
  9. toShort(final byte[] buffer, final int offset, final int length)