Android Byte Array to Short Convert bytesToShort(byte[] b)

Here you can find the source of bytesToShort(byte[] b)

Description

bytes To Short

Declaration

public static short bytesToShort(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    public static short bytesToShort(byte[] b) {
        short s0 = (short) (b[0] & 0xff);
        short s1 = (short) (b[1] & 0xff);
        s1 <<= 8;//from   ww w. j  ava2  s  . co  m
        return (short) (s0 | s1);
    }
}

Related

  1. bytesToShort(byte[] b)
  2. toShort(byte[] in)
  3. byte2Short(byte bin)
  4. byteArray2Short(byte[] b)
  5. byteArrayToShort(byte[] b, int offset)