Java tutorial
//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; } }