Java Byte Array to Short byte2short(byte[] ba)

Here you can find the source of byte2short(byte[] ba)

Description

byteshort

License

Open Source License

Declaration

public static short[] byte2short(byte[] ba) 

Method Source Code

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

public class Main {
    public static short[] byte2short(byte[] ba) {
        int length = ba.length;
        short[] sa = new short[length / 2];
        for (int i = 0, j = 0; j < length / 2;) {
            sa[j++] = (short) (((ba[i++] & 0xFF) << 8) | ((ba[i++] & 0xFF)));
        }// www .j  av  a 2 s .com
        return (sa);
    }
}

Related

  1. arr2short(byte[] arr)
  2. bufferToShort(byte[] ioBuffer)
  3. byte2short(byte[] data)
  4. byte2short(byte[] value, int offset)
  5. byte2Short(int loc, byte b[])
  6. bytes2short(byte[] b)