import java.util.Scanner;
import java.io.*;
import java.util.ArrayList;
public class Test
{
public static void main (String args[]) throws java.io.IOException
{
Scanner s = new Scanner(new File("D:\\Work\\Semester 2\\Prog\\population.txt"));
ArrayList<Integer> list = new ArrayList<Integer>();
while (s.hasNext()){
if(s.hasNextInt()){
list.add(s.nextInt());
} else {
s.next();
}
}
s.close();
System.out.println("Enter a number.\n");
Scanner scan = new Scanner(System.in);
String input = scan.next();
scan.close();
int inputNum = Integer.parseInt(input);
int number = 0;
if(number==0){
String line = list;
Scanner scanner = new Scanner(list);
int lineNum = Integer.parseInt(line);
}
}
}
So far I have managed to retrieve integers from a file and insert them into an ArrayList. Now I need to take an input from the user and it needs to display the number of of values (from the ArrayList) that is greater than or equal to the number the user entered. As you can see I'm trying to think of how to scan the ArrayList but I'm currently lost as to what I need to do, any help would be much appreciated.