This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Advice please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Advice please" Watch "Advice please" New topic
Author

Advice please

Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
Hi there.

I have to create (through a number of computational methods) a matrix of data. As an example here is one:

What I need to do is store this matrix in a text file, tab-delimited.

What I would like to know is whether it would be easier to create a 2-dimensional [n][n] array first and then copy the contents of it over to the file, or form the matrix in the file directly.

Thanks


Moosey knows best
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

I would think not only easier, but far cleaner. Separating your I/O code and your computational code into different methods (or even different classes) will make the whole thing easier to develop.


[Jess in Action][AskingGoodQuestions]
rohit leeta
Ranch Hand

Joined: May 02, 2007
Posts: 49
I agree. Make sure that you have a class holding your data and later think serializing it to a file.


<a href="http://www.java-forums.org" target="_blank" rel="nofollow">Java Forums</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Advice please
 
Similar Threads
Spiral Matrix
SoDuko puzzle
need explanation about constructor
Help me with matrix...please!!!!!!!
Complex Numbers in Java