Byte array convert

Hello Everyone!

I'm really new to everything around Arduino, and this is my first post.
Anyone can tell me how to convert a byte array to a float array? (I googled, failed)
I don't have much experience with C++.

The plan is to send packets via UDP from a pc, and recieve it with Arduino.
Each packet consists of two float values.

The way I converted them in Java:

private static byte[] float2byteArray(float... args) {
        ByteBuffer buffer = ByteBuffer.allocate(4 * args.length);
        
        for (float f : args) {
            buffer.putFloat(f);
        }
        
        return buffer.array();
    }

OR (both same effect)

public static byte[] floatToByteArray(float value) {
        int intBits =  Float.floatToIntBits(value);
        return new byte[] {(byte) (intBits >> 24), (byte) (intBits >> 16), (byte) (intBits >> 8), (byte) (intBits)};
    }

On most arduinos, a float is 4 bytes so the easiest way is to define a struct that can be viewed as either a single float or an array of 4 bytes.

union myData
{
  float myFloat;
  byte myBytes[4];
}

Then, you can read in your bytes and store them in the myBytes array and later just access myFloat to get the floating point number.