java - 2-Dimensional array storage -


i have stumbled upon problem. want store 2-dimensional int array in file read later. there way of doing other simple txt.file? it's first post here, , excuse english. (java programming language)

as indicated @andy can use objectoutputstream serialize array file

int[][] intarray = new int[5][5]; //code populate array  // serialize array fileoutputstream fos = new fileoutputstream("array.dat"); objectoutputstream oos = new objectoutputstream(fos); oos.writeobject(intarray); 

and can read array file using objectinputstream

fileinputstream fis = new fileinputstream("array.dat"); objectinputstream iis = new objectinputstream(fis); intarray = (int[][]) iis.readobject(); 

hope helps.


Comments

Popular posts from this blog

javascript - Why Selenium can't find an element that is graphically visible -

android - Basic camera in app -

scala - Using the kronecker product on complex matrices with scalaNLP breeze -