how to iterate on array[...][i] (columns) in java -
there easy way access rows of 2d array in java
for (int = 0 ; < integer2d.length ; i++) getmyarray(integer2d[i]);
but, searched in web find such easy way iterate on columns of 2d-array, like
for (int j = 0 ; j < integer2d[0].length ; j++) getmyarray(integer2d[][i]);
or
for (int j = 0 ; j < integer2d[0].length ; j++) getmyarray(integer2d[...][i]);
which works in programming languages. found class realmatrix , matrixutils can convert array2d real matrix , transpose , again convert array , iterate on it. suppose there exist simpler way?
edit: iterating on rows noted in first piece of code easy main question how iterate on columns second , third codes work in other programming languages.
edit2: mentioned in last paragraph of main question, easiest way know transposing matrix , iterating on rows.
for this, can use bigmatriximpl class of commons math library. has getcolumnasdoublearray() method return specified column array.
Comments
Post a Comment