nums.add untuk menambahkan nomor ke array dalam sampel java

package week8;

import java.util.ArrayList;
import java.util.Scanner;

public class ArrayListSum {
	
	public static int sumValues(ArrayList<Integer> nums) {
		int sum = 0;
		for(int i = 0; i < nums.size(); i++)
		 {          
		 }
		 return sum;
	}
	static int total;
	public static void main(String args[]) {
	
		//create an array list
	ArrayList <Integer> nums=new ArrayList<>();
		sumValues(nums);
	
	String input= "";
		
		Scanner in = new Scanner (System.in); 
			System.out.println("This program will ask the user to enter a series of numbers.");
			System.out.println("The user may enter as many numbers as they wish, hitting the enter key with no data when they wish to stop.");
			System.out.println("The program will then display the array of numbers and the sum total of those numbers.");
			System.out.println();	
			String s = new String();
			
	for(int i=0;i<5;i++) {
		//game loop
		boolean game= false;{


//start of do-while loop- user's input
do {
	boolean Num1 = false;
	
	do {
		System.out.println ("Please enter a number (or just hit enter to finish):");
		input = in.nextLine();
		
		try {
		num1 = Integer.parseInt(input);
		valid = true;
		
		}catch (Exception e) {
		System.out.println("Invalid Response! Please enter a whole number.");
		
	} 
	} while (!Num1);
	
	
	
	}while (!valid);
		
	int main() {
		   int i=0
		   while (true){
		   	cout<<"Input x:";
		    cin>> x;
		    cout<<"Value of x:"<<x<<endl;
		    if ((x % 5 == 0)
		    	break;
		   }
		
			
} while (!game);
} while (!game);
}
	for(int j=0;j<nums.size();j++);
		int j = 0;
		total+=nums.get(j);
		
	System.out.println("the sum is" +total);

	}in.close();
	}
}
	
  
Kristel Enriquez