Here you can find the source of shotToBuffer(short[] a)
public static ShortBuffer shotToBuffer(short[] a)
//package com.java2s; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; public class Main { public static ShortBuffer shotToBuffer(short[] a) { ByteBuffer mbb = ByteBuffer.allocateDirect(a.length * 2); mbb.order(ByteOrder.nativeOrder()); ShortBuffer sBuffer = mbb.asShortBuffer(); sBuffer.put(a);/*w w w . j a v a 2 s . com*/ sBuffer.position(0); return sBuffer; } }