Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static byte[] float2bytes(float value) {
        byte[] result = new byte[4];
        int temp = Float.floatToIntBits(value);

        for (int i = 0; i < 4; i++) {
            result[i] = new Integer(temp).byteValue();
            temp = temp >> 8;
        }

        return result;
    }
}