Here you can find the source of newShortBuffer(int numShorts)
public static ShortBuffer newShortBuffer(int numShorts)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { public static ShortBuffer newShortBuffer(int numShorts) { ByteBuffer buffer = ByteBuffer.allocateDirect(numShorts * 2); buffer.order(ByteOrder.nativeOrder()); return buffer.asShortBuffer(); }/*from www .j av a 2 s. c om*/ }