java How to find the max of each row in a 2d array
<p>i'm writing a function that retrieves the maximum of each row in a 2d array, and returns a 1d array, where each index is relative to the 2d array's column row index.</p>

<p>For example, if I have an 2d array:</p>

<pre><code>{1,2,3}
{4,5,6}
{7,8,9}
</code></pre>

<p>it should return an array of </p>

<pre><code>{3,6,9}
</code></pre>

<p>here is my code so far:</p>

<pre><code>double[] rowMaxes(double[][] nums) {
    double [] count = new double [nums.length];
    for(int i = 0; i &lt; count.length; i++){
        for(int x = 0; x &lt; nums[0].length; x++){
            for(int n = 0; n &lt; nums.length; n++){
                if(nums[x][n] &gt; count[i]){
                    count[i] = nums[x][n];
                }
            }
        }
    }
    return count;
}
</code></pre>