Java Byte Array to Short bytes2Short(byte[] bytes)

Here you can find the source of bytes2Short(byte[] bytes)

Description

bytes Short

License

Open Source License

Declaration

public static short bytes2Short(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static short bytes2Short(byte[] bytes) {
        short val = 0;
        for (int i = 0; i < 2; i++) {
            val |= (0xFF & (short) bytes[i]) << (8 * i);
        }//w  w w  .  ja  va  2  s  .c  om
        return val;
    }
}

Related

  1. byte2short(byte[] ba)
  2. byte2short(byte[] data)
  3. byte2short(byte[] value, int offset)
  4. byte2Short(int loc, byte b[])
  5. bytes2short(byte[] b)
  6. bytes2short(byte[] bytes, int offset, boolean bigEndian)
  7. bytes2Short(byte[] input)
  8. bytes2short(byte[] src)
  9. bytesToShort(byte A, byte B)