集册 Java实例教程 此实用程序函数返回一个数组副本,其中包含给定2D数组的传递行索引

此实用程序函数返回一个数组副本,其中包含给定2D数组的传递行索引

欢马劈雪     最近更新时间:2020-01-02 10:19:05

399
此实用程序函数返回一个数组副本,其中包含给定2D数组的传递行索引


//package com.nowjava;

/* 
 来自 
*N o w J a v a . c o m - 时代Java*/

public class Main {

    /**

     * This utility function returns an array copy containing of passed row

     * index of a given 2D array

     * 

     * @param twoDdoubleArray

     *            the original 2D double array from which a row will be copied

     *            and return as an array

     * @param row

     *            a row index indicating the row which needs to be taken out

     *            (copied and returned)

     * @return an array (double) containing a copy of its needed row (index

     *         passed as argument)

     */

    public static double[] rowCopy(double[][] twoDdoubleArray, int row) {

        double[] rowCopyArr = new double[twoDdoubleArray[0].length];

        for (
展开阅读全文