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.  ja  v a  2s  .co  m
        return (short) (s0 | s1);
    }
}

Related

  1. bytesLE2shorts(byte[] b)
  2. bytesLE2sshort(byte[] b, int off)
  3. bytesLE2sshorts(byte[] b)
  4. bytesLE2ushort(byte[] b, int off)
  5. bytesLE2ushorts(byte[] b)
  6. bytesToShort(byte[] b)
  7. bytesToShort(byte[] bytes)
  8. getShort(byte[] b, int index)
  9. getShort(byte[] b, int index)