Java ByteBuffer Get getFloat(ByteBuffer floatCalculator, byte[] bytes)

Here you can find the source of getFloat(ByteBuffer floatCalculator, byte[] bytes)

Description

Calculates the corresponding float given 4 sequential bytes.

License

LGPL

Parameter

Parameter Description
floatCalculator Buffer to do the conversion
bytes The bytes

Return

Float value of the bytes

Declaration

public static float getFloat(ByteBuffer floatCalculator, byte[] bytes) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.nio.ByteBuffer;

public class Main {
    /**/*from   w  ww  .  j a v a 2s .co m*/
     * Calculates the corresponding float given 4 sequential bytes.
     * @param floatCalculator Buffer to do the conversion
     * @param bytes The bytes
     * @return Float value of the bytes
     */
    public static float getFloat(ByteBuffer floatCalculator, byte[] bytes) {
        floatCalculator.clear();
        floatCalculator.put(bytes);
        floatCalculator.position(0);
        return floatCalculator.getFloat();
    }
}

Related

  1. getDoubleFromByteBuffer(ByteBuffer data)
  2. getEmptyByteBuffer()
  3. getFixedBytes(ByteBuffer buffer, int length)
  4. getFloat(ByteBuffer b, int n)
  5. getFloat(ByteBuffer buffer)
  6. getFromBack(ByteBuffer bb)
  7. getHashBytes(ByteBuffer bb)
  8. getHSBfromRGB(final ByteBuffer pixels, final float[] result, int pixelSize)
  9. getIncreasingByteBuffer(int len)