public static ShortBuffer createShortBuffer(int elements)
    {
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(elements * 2);
        byteBuffer.order(ByteOrder.nativeOrder());
        return byteBuffer.asShortBuffer();
    }
public static ShortBuffer createShortBuffer ( int elements ) { ByteBuffer byteBuffer = ByteBuffer . allocateDirect ( elements * 2 ) ; byteBuffer . order ( ByteOrder . nativeOrder ( ) ) ; return byteBuffer . asShortBuffer ( ) ; }
Creates a buffer for the given number of elements and
native byte ordering

@param elements The number of elements in the buffer
@return The buffer