Java Float Array Create toFloatArrays(double[][] arrays)

Here you can find the source of toFloatArrays(double[][] arrays)

Description

to Float Arrays

License

Open Source License

Declaration

public static float[][] toFloatArrays(double[][] arrays) 

Method Source Code

//package com.java2s;
/* MOD_V2.0//from   w  w  w  .j a  v a 2  s .  c  o m
 * Copyright (c) 2012 OpenDA Association
 * All rights reserved.
 * 
 * This file is part of OpenDA. 
 * 
 * OpenDA is free software: you can redistribute it and/or modify 
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of 
 * the License, or (at your option) any later version. 
 * 
 * OpenDA 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 Lesser General Public License for more details. 
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with OpenDA.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static float[][] toFloatArrays(double[][] arrays) {
        float[][] res = new float[arrays.length][];
        for (int i = 0; i < arrays.length; i++) {
            res[i] = toFloatArray(arrays[i]);
        }

        return res;
    }

    public static float[] toFloatArray(double[] array) {
        float[] res = new float[array.length];

        for (int i = 0; i < res.length; i++) {
            res[i] = (float) array[i];
        }

        return res;
    }
}

Related

  1. toFloatArray(Number[] array)
  2. toFloatArray(Object[] arr)
  3. toFloatArray(String str, String separator)
  4. toFloatArray(String text, String delim)
  5. toFloatArray(String[] anArray)
  6. toFloatByObject(Object obj)
  7. toFloatMatrix(int[][] m)
  8. toFloatRawBits(int i)
  9. toFloats(byte[] bytes)