I have a method where I pass two int arguments, and returns a string. A loop will make sure that if the first argument(the greater value) is greater than the second, that the first will decrement until it is equal the value of the second argument(the lesser value).
The problem I'm having is that I am trying to return the value of the decremented value after each time that the loop runs. I would like to return the values as a string like "8,6,4,2".How would i set that up?
public String countDown(int arg1, int arg2){
if (arg1>arg2){
for (int i = arg1; arg1>arg2;i--){
//???
return i;
}
}
int[]orList<int>.returnfrom it, or else it's going to exit the first time through if it has thereturnin it. Either way, it doesn't make sense.