Here you can find the source of toShortBuffer(short[] array)
public static ShortBuffer toShortBuffer(short[] array)
//package com.java2s; //License from project: Apache License import java.nio.*; public class Main { public static ShortBuffer toShortBuffer(short[] array) { ByteBuffer bb = ByteBuffer.allocateDirect(array.length << 1); bb.order(ByteOrder.nativeOrder()); bb.position(0);//from ww w . j av a2 s .com ShortBuffer sbb = bb.asShortBuffer(); sbb.put(array); return sbb; } }