Here you can find the source of toFloat16BE(ByteBuffer buf, FloatBuffer out)
private static void toFloat16BE(ByteBuffer buf, FloatBuffer out)
//package com.java2s; /**//from ww 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; import java.nio.FloatBuffer; public class Main { public final static float r16 = 1f / 32768f; private static void toFloat16BE(ByteBuffer buf, FloatBuffer out) { while (buf.remaining() >= 2 && out.hasRemaining()) { out.put(r16 * (short) (((buf.get() & 0xff) << 8) | (buf.get() & 0xff))); } } }