Java 'Write' and Java 'Read'

David Roden's icon
nick rothwell | project cassiel's icon

On 6 Feb 2008, at 15:47, David Roden wrote:

> for(int i = 0; i < (4 * arraySize); i++)
> {
> while(i < arraySize)
> {pBank[i] = sc.nextInt();}
>

You're doing "while" tests on the control variable of a for-loop, so
I'm surprised you're not just running into an infinite loop, unless
some of the initialisation is wrong.

I think this entire read loop needs to be restructured: what's wrong
with four loops in succession?

    -- N.

Nick Rothwell / Cassiel.com Limited
www.cassiel.com
www.myspace.com/cassieldotcom
www.last.fm/music/cassiel
www.reverbnation.com/cassiel
www.linkedin.com/in/cassiel
www.loadbang.net

Mattijs's icon

Moving this thread to the Java forum.

David's icon

Thanks Nick.

You're right of course about the overly complicated loop, though that wasn't the source of the difficulty.

I've subsequently worked around it by backing up the arrays to dat files using DataOutPutStream. I've kept the text write method in as it was a handy debugging tool while tweaking my new Import and Export methods!