I want this program to take an array list "max" that the size is created by the user. Then the program uses the Fibonacci sequence to store all the Fibonacci numbers in the arraylist that are less than the arraylist "max" which is created by the user input.
import java.util.*;
import javax.swing.*;
public class FibonacciArrayList {
public static ArrayList<Integer> Fibonacci (Integer Max){
ArrayList<Integer> A = new ArrayList<Integer>();
int n0;
int n1;
int n2;
for(int i= 0; i = max; i++){
n2= n1 + n0;
system.out.println(n2);
n0=n1;
n1=n2;
return A;
}
public static void main (String[] arg){
Integer max;
String Title = "Fibonacci ArryList";
String data = JOptionPane.showInputDialog(null, "Enter the upper bound", Title, 1);
max = new Integer(data);
ArrayList<Integer> A = Fibonacci(max);
System.out.println("There are " + A.size()+ " Fibonacci numbers less than "+max);
}
}