Here you can find the source of shorts(ByteBuffer buffer)
public static short[] shorts(ByteBuffer buffer)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ShortBuffer; public class Main { public static short[] shorts(ByteBuffer buffer) { ShortBuffer samples = buffer.asShortBuffer(); short[] shorts = new short[samples.limit()]; for (int i = 0; i < samples.limit(); i++) shorts[i] = samples.get(i);//from ww w. j av a2 s. c o m return shorts; } }