I need help finding how to segment an array to find every four values and see if those values go over 10. I tried to implement .subList but I'm not sure if that would be on the right track. Below is what i currently have done so far so thanks for help in advance.
import java.util.Scanner;
public class Problem1 {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
System.out.print( "Enter how many downs there are:");
int x = sc.nextInt();
double[] yards = new double [x];
double num1 = 0;
for (int i = 0; i < yards.length; i++){
//System.out.print( (i+1)+ " Enter the quality of the food on a scale from 1-5:");
System.out.print( "Enter the yards they moved:");
yards[i] = sc.nextDouble();
num1 += yards[i];
if (yards[i] <=0){
System.out.print("SAFETY");
}
if ( num1 == 100){
System.out.print("TOUCHDOWN");
System.exit(0);
//System.out.print( num1 );
}
}
}
}
}