Here you can find the source of toShorts(byte[] readBuffer, int o, int l)
public static short[] toShorts(byte[] readBuffer, int o, int l)
//package com.java2s; //License from project: Open Source License public class Main { public static short[] toShorts(byte[] readBuffer, int o, int l) { short[] v = new short[l / 2]; for (int i = 0; i < v.length; i++) v[i] = toShort(readBuffer, o + i * 2); return v; }//from w w w .j a va 2 s. co m public static short toShort(byte[] readBuffer, int o) { return (short) (((readBuffer[o + 0] & 255) << 8) + ((readBuffer[o + 1] & 255) << 0)); } public static short toShort(byte[] readBuffer) { return toShort(readBuffer, 0); } }