question: public static HashMap < CellIndex , Double > convert2DDoubleArrayToHashMap ( double [ ] [ ] matrix ) { HashMap < CellIndex , Double > hmMatrix = new HashMap < CellIndex , Double > ( ) ; for ( int i = 0 ; i < matrix . length ; i ++ ) { for ( int j = 0 ; j < matrix [ i ] . length ; j ++ ) { if ( matrix [ i ] [ j ] != 0 ) hmMatrix . put ( new CellIndex ( i + 1 , j + 1 ) , matrix [ i ] [ j ] ) ; } } return hmMatrix ; }
target:  Converts a 2D array into a sparse hashmap matrix.