Here you can find the source of toFloatArray(int[] intArray)
public static float[] toFloatArray(int[] intArray)
//package com.java2s; /*//from ww w .j a v a 2 s. c o m * #%L * Ice-9 Tickerplant - Server * %% * Copyright (C) 2014 - 2015 Snowfall Systems, Inc. * %% * This file is part of PortfolioEffect Quant Client. * * PortfolioEffect Quant Client is free software: you can redistribute * it and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * PortfolioEffect Quant Client is distributed in the hope that it will * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with PortfolioEffect Quant Client. If not, see <http://www.gnu.org/licenses/>. * #L% */ import java.nio.ByteBuffer; public class Main { public static float[] toFloatArray(byte[] byteArray) { int times = Float.SIZE / Byte.SIZE; float[] floats = new float[byteArray.length / times]; for (int i = 0; i < floats.length; i++) { floats[i] = ByteBuffer.wrap(byteArray, i * times, times).getFloat(); } return floats; } public static float[] toFloatArray(int[] intArray) { float[] floats = new float[intArray.length]; for (int i = 0; i < intArray.length; i++) { float value = Float.intBitsToFloat(intArray[i]); floats[i] = value; } return floats; } }