Java examples for java.nio:ShortBuffer
allocate Direct ShortBuffer
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { public static void main(String[] argv) throws Exception { int size = 2; System.out.println(allocateDirectShort(size)); }/* ww w .j a va 2 s.c o m*/ public static ShortBuffer allocateDirectShort(int size) { ByteBuffer bb = ByteBuffer.allocateDirect(size * 2); bb.order(ByteOrder.nativeOrder()); return bb.asShortBuffer(); } }