Java examples for Collection Framework:Array Copy
This utility function returns a copy of the specific column of a passed 2D double array as a one dimensional double array.
//package com.java2s; public class Main { /**// w ww . ja va 2 s . c o m * This utility function returns a copy of the specific column of a passed * 2D double array as a one dimensional double array. * * @param twoDfloatArray * a 2D double array whose column is supposed to be fetched and * return * @param colNb * the number of column whose values are supposed to be returned * as array * @return an array (double) containing a copy of the passed column number * and 2D array */ public static double[] colCopy(double[][] twoDdoubleArray, int colNb) { double[] aCol = new double[twoDdoubleArray.length]; for (int i = 0; i < twoDdoubleArray.length; i++) { aCol[i] = twoDdoubleArray[i][colNb]; } return aCol; } }