Java Byte Array to Short bytesToShort(byte A, byte B)

Here you can find the source of bytesToShort(byte A, byte B)

Description

bytes To Short

License

Open Source License

Declaration

public static short bytesToShort(byte A, byte B) 

Method Source Code

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

public class Main {
    public static final short MASK_TO_BYTE = 0xFF;

    public static short bytesToShort(byte A, byte B) {
        short i = (short) (B & MASK_TO_BYTE);
        i |= ((A & MASK_TO_BYTE) << 8);

        return i;
    }//from  w w  w. j a  v a 2 s. com
}

Related

  1. bytes2short(byte[] b)
  2. bytes2Short(byte[] bytes)
  3. bytes2short(byte[] bytes, int offset, boolean bigEndian)
  4. bytes2Short(byte[] input)
  5. bytes2short(byte[] src)
  6. bytesToShort(byte a, byte b, boolean swapBytes)
  7. bytesToShort(byte b1, byte b2)
  8. bytesToShort(byte byte1, byte byte2)
  9. bytesToShort(byte hiByte, byte loByte)