Android Byte Array to Short Convert byteArrayToShort(byte[] b, int offset)

Here you can find the source of byteArrayToShort(byte[] b, int offset)

Description

byte Array To Short

Declaration

private static short byteArrayToShort(byte[] b, int offset) 

Method Source Code

//package com.java2s;

public class Main {
    private static short byteArrayToShort(byte[] b, int offset) {
        short value = 0;
        for (int i = 0; i < 2; i++) {
            int shift = (2 - 1 - i) * 8;
            value += (b[i + offset] & 0x000000FF) << shift;
        }/*  w  w w .j a va 2  s  .com*/
        return value;
    }
}

Related

  1. bytesToShort(byte[] b)
  2. bytesToShort(byte[] b)
  3. toShort(byte[] in)
  4. byte2Short(byte bin)
  5. byteArray2Short(byte[] b)
  6. bytesBE2shorts(byte[] b)
  7. bytesBE2sshort(byte[] b, int off)
  8. bytesBE2sshorts(byte[] b)
  9. bytesBE2ushort(byte[] b, int off)