Here you can find the source of createShortBuffer(int size)
public static ShortBuffer createShortBuffer(int size)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { public static ShortBuffer createShortBuffer(int size) { ByteBuffer bb = ByteBuffer.allocateDirect(size * 2); bb.order(ByteOrder.nativeOrder()); return bb.asShortBuffer(); }// ww w . ja v a 2s .c om }