Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void readData(){
- // Initialise the array (size should be at least 2000)
- int[] data = new int[2000];
- File file = new File(FileChooser.open("Choose file to be read"));
- // read the data from the file into the array
- try {
- count = 0;
- Scanner scan = new Scanner(file);
- while (scan.hasNextInt()){
- int currentNum = scan.nextInt();
- this.data[count++] = currentNum;
- }
- }
- catch(IOException e){
- JOptionPane.showMessageDialog(this.frame, "File loading failed: "+e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement