Basically I want to know how to apply an if condition to every element of an arraylist. Here's my code.
   System.out.println("Type positive integers less than 40: ");
    ArrayList<Integer> inRay = new ArrayList<Integer>();
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext())
    {
        inRay.add(sc.nextInt());
    }
    //this is where the problem starts//
    int i;
    if (inRay.get(i) > 40)
    {
        System.out.println("You had one job.");
        System.exit(0);
    }
I would like to apply an if condition where if a value in the array list is over 40, it exits.
 
     
    