Android Byte Array to Float Convert bytesToFloat(byte[] bytes, int start)

Here you can find the source of bytesToFloat(byte[] bytes, int start)


bytes To Float


Open Source License


public static float bytesToFloat(byte[] bytes, int start) 

Method Source Code

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

import java.nio.ByteBuffer;

public class Main {
    private static final int FLOAT_BYTES = Float.SIZE / 8;
    private static final ByteBuffer FLOAT_BUFFER = ByteBuffer
            .allocate(FLOAT_BYTES);/*  w ww.  jav a 2s .co  m*/

    public static float bytesToFloat(byte[] bytes, int start) {
        FLOAT_BUFFER.put(bytes, start, FLOAT_BYTES);
        return FLOAT_BUFFER.getFloat(0);


  1. bytesBE2floats2doubles(byte[] b)
  2. bytesLE2float(byte[] b, int off)
  3. bytesLE2floats(byte[] b)
  4. bytesLE2floats2doubles(byte[] b)
  5. bytesToFloat(byte[] bytes)
  6. getFloat(byte[] b, int index)
  7. getFloat(byte[] buf, boolean bigEndian)
  8. getFloat(byte[] bytes)
  9. getFloat(int offset, byte[] fromBytes)