Here you can find the source of toInt16BE(ByteBuffer buf, int[] out)
private static int toInt16BE(ByteBuffer buf, int[] out)
//package com.java2s; /**//from w w w .ja v a2 s. c o m * This class is part of JCodec ( www.jcodec.org ) This software is distributed * under FreeBSD License * * @author The JCodec project * */ import java.nio.ByteBuffer; public class Main { private static int toInt16BE(ByteBuffer buf, int[] out) { int samples = 0; while (buf.remaining() >= 2 && samples < out.length) { out[samples++] = (short) (((buf.get() & 0xff) << 8) | (buf.get() & 0xff)); } return samples; } }