Java ByteBuffer to Float toFloat(ByteBuffer value)

Here you can find the source of toFloat(ByteBuffer value)

Description

to Float

License

Open Source License

Declaration

public static float toFloat(ByteBuffer value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static float toFloat(ByteBuffer value) {
        float result = 0f;
        try {//from   w ww.  j  a va  2  s . co m
            if (value != null) {
                int originPos = value.position();
                result = value.getFloat();
                value.position(originPos);
            }
        } catch (Exception ex) {
            // ex.printStackTrace();
        }
        return result;
    }
}

Related

  1. readFloatArray(ByteBuffer bb, int length)
  2. readFloats(final ByteBuffer bb, final int length)
  3. toFloat(AudioFormat format, ByteBuffer buf, float[] floatBuf)
  4. toFloat(ByteBuffer buffer)
  5. toFloat(ByteBuffer bytes)
  6. toFloat16BE(ByteBuffer buf, FloatBuffer out)
  7. toFloat24BE(ByteBuffer buf, float[] out)