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 bf = ByteBuffer.allocateDirect(size * 2); return bf.order(ByteOrder.nativeOrder()).asShortBuffer(); }//from ww w. j a va2s. co m }