Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
01-18-2005, 09:21 AM #1
- Join Date
- Dec 2004
- Thanked 0 Times in 0 Posts
How to pass data from type integer to integer Array?
I am doing algorithms(bubblesort) in which 'FileReader' class reads from file(numbers.txt). Numbers are read & display but can't do sorting because all numbers are stored in type integer 'int tok'(please see the code). I require numbers to be stored in array so that with the help of 'for' loop, I can do sorting.
Here is the code(just paste, compile, run)
public class FileMethods01
public static void main(String args) throws Exception
BufferedReader in= new BufferedReader(new FileReader("d:/numbers.txt"));
//put some numbers in 'numbers.txt' file
StreamTokenizer input=new StreamTokenizer(in);
System.out.println("Numbers Found:" +input.nval);
System.out.println("Found " + count+" numbers in numbers.txt");
}//end of main
}//end of class
so how to take numbers in Array?