Writing a matrix into a file in Java -


i'm trying write graph format file in java. problem i'm able write string types file. uploaded image showing 5 5 matrix, example: {{5,5,0,0,0},{0,1,0,1,0},{1,0,0,0,0},{0,0,1,0,0},{0,1,0,1,0},{0,0,0,0,0}}, while first row describes , gives information on following matrix - 5 rows, 5 columns.

my problem i'm able write strings file. have tried use string type , covert int, it's messy bit. lot!

so, data represented 2d array of integers? since can write strings file, consider converting data string, e.g.:

int[][] data = {{5,5,0,0,0},{0,1,0,1,0},{1,0,0,0,0},{0,0,1,0,0},{0,1,0,1,0},{0,0,0,0,0}}; string str = java.util.arrays.deeptostring(data); 

it give [[5, 5, 0, 0, 0], [0, 1, ...], ...].


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -