How to grab only a certain row of a two-dimensional matrix in java?
<p>When I have a two-dimensional matrix in java, but I only want to work with a certain row of that matrix respectively creating a new array that contains the contents of the matrix in that certain row, how would I accomplish that (with primitives)? </p>

<p>So, for example, we would write:</p>

<pre><code>int[][] matrix = new int[10][10];
</code></pre>

<p>Now we have a two-dimensional matrix with 10 rows and 10 columns. Assume that we fill the whole matrix with certain elements, and now, I wish to work only with the first row, meaning to define a new array that contains exactly the elements of the first row of the matrix. </p>