I'm running into this problem where if want to loop through an array and print out its contents separated by a comma, it prints out an extra at the end. I did some searching but, couldn't find an answer that worked for this situation.
Code:
public String toString(){
String hold= "";
for(int i = 0; i < array.length; i ++){
if(array[i] == true){
hold + = i;
if(i != array.length-1)
hold+= ",";
}
}
return hold;
}