Java 如何将二维数组中的一个参数设置为单个数组?

Java 如何将二维数组中的一个参数设置为单个数组?,java,eclipse,Java,Eclipse,我想知道如何将2D数组的行设置为单个数组中的第一个元素,将列设置为第二个元素 /** * findHighestLocation finds the row and column indexes of the * highest value in the given two dimensional array. * @param table The two dimensional array for which to find * the highest va

我想知道如何将2D数组的行设置为单个数组中的第一个元素,将列设置为第二个元素

/**
 * findHighestLocation finds the row and column indexes of the
 * highest value in the given two dimensional array.
 * @param table The two dimensional array for which to find 
 *              the highest value
 * @return a newly created one dimensional array of size 2. The
 *         first element contains the row index of the highest value 
 *         in table. The second element contains the column index
 *         of the highest value in table. */
public static int[] findHighestLocation(int[][] table) {
    int [] highestLocation = new int [2];
    int largest = table[0][0];

    for (int i = 0; i < table.length; i++)
    {
        if (table[i][i] > largest)
        {
            largest = table[i][i];
            highestLocation [0] = table[i][];
            highestLocation [1] = table[i][];
        }
    }
    return highestLocation;
}
/**
*findHighestLocation查找
*给定二维数组中的最大值。
*@param table要查找的二维数组
*最高值
*@return新建一个大小为2的一维数组。这个
*第一个元素包含最大值的行索引
*在桌子上。第二个元素包含列索引
*表中的最高值*/
公共静态int[]findHighestLocation(int[]]表){
int[]最高位=新int[2];
int最大=表[0][0];
对于(int i=0;i最大值)
{
最大值=表[i][i];
最高位置[0]=表[i][];
最高位置[1]=表[i][];
}
}
返回最高位置;
}

这与JavaScript根本没有关系。我的坏想法是我没想到我把它放在了他们的网页上。你能帮我写代码吗?标题和代码注释似乎不匹配。你能澄清一下你想做什么吗?提供示例输入和预期输出。这与JavaScript完全无关。我的坏想法是我没有把它们放在一起。你能帮我写代码吗?标题和代码注释似乎不匹配。你能澄清一下你想做什么吗?提供示例输入和预期输出。