Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static final int BYTES_PER_FLOAT = 4;

    public static float[] byteToFloatArrayBigEndian(byte[] data) {
        float[] floats = new float[data.length / BYTES_PER_FLOAT];
        ByteBuffer.wrap(data).order(ByteOrder.BIG_ENDIAN).asFloatBuffer().get(floats);
        return floats;
    }
}