Here you can find the source of toFloatBytes(List
public static byte[] toFloatBytes(List<Double> datas)
//package com.java2s; /**/* w w w . ja v a2 s . c om*/ * Copyright (C) 2014 Bnome SPRL (info@bnome.be) * * This file is part of VectionVR Stabilizer library. * * VectionVR Stabilizer library 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. * * VectionVR Stabilizer library 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 VectionVR Stabilizer library. If not, see <http://www.gnu.org/licenses/>. */ import java.nio.ByteBuffer; import static java.nio.ByteBuffer.allocate; import java.util.List; public class Main { public static byte[] toFloatBytes(List<Double> datas) { ByteBuffer buf = allocate(48); for (Double data : datas) { buf.putFloat(data.floatValue()); } buf.flip(); return buf.array(); } }