Here you can find the source of createShortBuffer(int shortCount)
public static ShortBuffer createShortBuffer(int shortCount)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { public static ShortBuffer createShortBuffer(int shortCount) { ByteBuffer data = ByteBuffer.allocateDirect(shortCount * 4); data.order(ByteOrder.nativeOrder()); ShortBuffer p1 = data.asShortBuffer(); return p1; }/*ww w. j a v a 2 s . co m*/ }