Java Byte Array to Float bytesToFloat(byte[] bytes)

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

Description

bytes To Float

License

Open Source License

Declaration

public static float bytesToFloat(byte[] bytes) 

Method Source Code

//package com.java2s;
/*//  ww  w  .  j  av a  2s.  c o m
 * Copyright 2012 Alibaba.com All right reserved. This software is the
 * confidential and proprietary information of Alibaba.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Alibaba.com.
 */

public class Main {

    public static float bytesToFloat(byte[] bytes) {
        int l;
        l = bytes[0];
        l &= 0xff;
        l |= ((long) bytes[1] << 8);
        l &= 0xffff;
        l |= ((long) bytes[2] << 16);
        l &= 0xffffff;
        l |= ((long) bytes[3] << 24);
        return Float.intBitsToFloat(l);
    }
}

Related

  1. bytes2Float(byte[] b, float defaultValue)
  2. bytes2float(byte[] bytes)
  3. bytes2float(byte[] bytes)
  4. bytesToFloat(byte[] b)
  5. bytesToFloat(byte[] b, int offset)
  6. bytesToFloat(byte[] bytes, int beg)
  7. bytesToFloat(byte[] bytes, int startIndex)
  8. byteToFloat(byte[] b)
  9. byteToFloat(byte[] b)