Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Advice please" Watch "Advice please" New topic

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.


Moosey knows best
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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="" target="_blank" rel="nofollow">Java Forums</a>
I agree. Here's the link:
subject: Advice please
It's not a secret anymore!