question: public static void writeMatrix ( double [ ] [ ] matrix , String fileName , String headerLine ) { ArrayList < String > list = new ArrayList < String > ( ) ; if ( headerLine != null ) { list . add ( headerLine ) ; } for ( int i = 0 ; i < matrix . length ; i ++ ) { String line = "" ; for ( int j = 0 ; j < matrix [ 0 ] . length - 1 ; j ++ ) { line += matrix [ i ] [ j ] ; line += "\t" ; } line += matrix [ i ] [ matrix [ 0 ] . length - 1 ] ; list . add ( line ) ; } writeList ( list , fileName ) ; }
target:  if headerLine=null, then add no line at top of file. "\n" is added at end of first line by this method. matrix[numberOfRows][numberOfColumns]