Outputting a randomized array to a file?

And randomizeArray – Jake223 Nov 29 at 22:06 @Jake223 outputArray calls randomizeArray – Vilas Jagannath Nov 29 at 22:12 @Vilas Jagannath didn't notice... – Jake223 Nov 29 at 22:13.

One of your problems is the line: new PrintStream(output). Println(randomizeArray(numbers)); This will probably print something like: I@10769dd yes? You need to write a for loop to output the numbers, something like: for (int i=0; I Length; i++) { new PrintStream(output).

Println(numbersi); } except that you don't want to create the PrintStream each time in the loop.

Your main method initializes an array of 201 elements (instead of 200), and doesn't do anything with this array. So obviously, there is no randomization and now writing to any file. The main method should call randomizeArray and then outputArray.

The initialization of the array elements in main is useless, since the elements will be reinitialized by the randomizeArray method. This method, by the way, doesn't need to return anything. Finally, the outputArray method should loop through the array and println each element.

The stream should be closed in a finally block. It should not return anything either.

1) you need to use Arrays. ToString(int arr) to print that array. 2) if you mean to reorder the array input, that requires code tht is very diferent.

Otherwise, get rid of the input and use a new array. 3) call your helper methods! EDIT: added this psuedocode: boolean used=new boolean200; make old and new for(i=0;i.

Couldn't resist... String filename = "random200. Txt"; List numbers = new ArrayList(); for (int I = 1; I NextInt(numbers.size()); Integer randomNumber = numbers. Remove(position); sb.

Append(randomNumber + "\n"); } try { Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF8")); out. Append(sb.toString()); out.close(); } catch (Exception ex) { throw new RuntimeException(ex); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions