Counting will start with a given number and end at the second given number. ex. input 5 and 10 , output= 5 6 7 8 9 10
Here is an example of what you are trying to achieve
public static ArrayList<Integer> getNumbers(Integer input1, Integer input2) {
ArrayList <Integer> numbersList = new ArrayList <Integer>();
for (i = input1; i <= input2; i++) {
numbersList.add(i)
}
return numbersList;
}
So if i want to call that i can just do in your case(in the main method)
Integer first = 5;
Integer second = 10;
getNumbers(first,second);
NOTE You have to use the type Integer because you cant add a primitive type int to a Integer array list…