Java Double Convert to double2dimToFloat1Dim(double[][] points)

Here you can find the source of double2dimToFloat1Dim(double[][] points)

Description

doubledim To Float Dim

License

Open Source License

Declaration

public static float[] double2dimToFloat1Dim(double[][] points) 

Method Source Code

//package com.java2s;
/*/*ww w .  ja va2 s .  co m*/
 * This file is part of glei.
 * Copyright (C) 2012 Tommi Tervonen.
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static float[] double2dimToFloat1Dim(double[][] points) {
        int nrPoints = points.length;
        int sizePoint = points[0].length;

        float[] res = new float[nrPoints * sizePoint];
        for (int i = 0; i < nrPoints; i++) {
            for (int j = 0; j < sizePoint; j++) {
                res[i * sizePoint + j] = (float) points[i][j];
            }
        }
        return res;
    }
}

Related

  1. convertDoubleValuesFromNetcdf(double[] netcdfData, double missingValue, double scaleFactor, double offSet)
  2. double2Arr(double var, byte[] arrayBytes, int startIndex)
  3. double2array(int sz, double seed)
  4. double2bin(double d)
  5. double2bipolar(final double d[])
  6. double2fixed(double value)
  7. double2Float(double[] v)
  8. double2int(final double d)
  9. double2long(double value)