public static void printJava(PrintStream out , DMatrix mat , String format ) { String type = mat.getType().getBits() == 64 ? "double" : "float"; out.println("new "+type+"[][]{"); format += " "; for( int y = 0; y < mat.getNumRows(); y++ ) { out.print("{"); for( int x = 0; x < mat.getNumCols(); x++ ) { out.printf(format,mat.get(y,x)); if( x+1<mat.getNumCols()) out.print(", "); } if( y+1 < mat.getNumRows()) out.println("},"); else out.println("}};"); } }