Saving from, and loading to an array.
Hi all, basically, I want to save data from an array to a file, and then be able to load it again. The data comes to the array from a tokenizer, so I want to put the data into the file after it has been passed to the array from the tokenizer.
Thanks in advance.
public void stringTokenizer(String a)
//Creates variable for loop counter.
//Creates StringTokenizer object that takes 'a' parameter from method sig, and had deliminator ','.
StringTokenizer tokenizer = new StringTokenizer(a, ",");
//Creates notesTwo array with the amount of indexes defined by the value of tokenizer.countToken()
notesTwo = new int[tokenizer.countTokens()];
//Initializes 'i' to zero.
i = 0;
//While hasMoreTokens is true (when there are still parts of the string to process), the loop will run.
//Integer converts each token to an int.
//Creates Integer object with the input nextToken; nextToken feeds token to the integer function; hence it is Integer's parameter.
//Each time the tokenizer is run, the string is essentially shortened as different tokens are processed.
Integer intStore = new Integer(tokenizer.nextToken());
//Stores the value of intStore(Integer Object) into the notesTwo Array. Array index is defined by i++
notesTwo[i] = intStore.intValue();
//Increments 'i' variable by one.
//Refer to notes on populateArray. NOTE: uses second Array, and second payNote method. NOT initially coded Method.
runs = 0;
wait = 500;
while(runs < 4)