This is my code, and hopefully the small comments I've left would help describe my thought process for each step. I am unsure why this method returns only 0s @_@
public static int maxLength(ArrayList<String> list) {
int counter = 0; //Initialize the counter.
int tracker = 0; //Saves the highest int count.
for(int i = 0; i<list.size(); i++){ //Runs through the ArrayList
String n = list.get(i); //Gets the value of the index
for(int j = 0; j<n.length();j++){ //Counts the amount of characters.
if (n.charAt(j)!=' '){
counter++;
}
}
if (counter > tracker){ //Replaces the value of tracker if counter is higher
counter = tracker;
}
counter = 0;
}
return tracker;
}