Java Byte Array to Short byte2short(byte[] data)

Here you can find the source of byte2short(byte[] data)

Description

byteshort

License

Open Source License

Declaration

public static final short byte2short(byte[] data) 

Method Source Code

//package com.java2s;

public class Main {

    public static final short byte2short(byte[] data) {
        if (data != null && data.length == 2) {
            return (short) (((data[1] & 0xff) << 8) + (data[0] & 0xff));
        }// www.  ja v a2 s.  c o m
        return 0;
    }
}

Related

  1. arr2short(byte[] arr)
  2. bufferToShort(byte[] ioBuffer)
  3. byte2short(byte[] ba)
  4. byte2short(byte[] value, int offset)
  5. byte2Short(int loc, byte b[])
  6. bytes2short(byte[] b)
  7. bytes2Short(byte[] bytes)