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

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

Description

bytes To Short

License

Open Source License

Declaration

public static short bytesToShort(byte[] b) 

Method Source Code

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

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static short bytesToShort(byte[] b) {
        ByteBuffer buf = ByteBuffer.wrap(b, 0, 2);
        buf.order(ByteOrder.LITTLE_ENDIAN);
        return buf.getShort();
    }/*from w  w  w  . j  a  va 2 s  . co m*/
}

Related

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