I made a method that returns a string. I'm trying to allow the string to be expanded through a for loop like so:
public static String averageFood(){
String average = "";
String temp = "";
for (int i = 0; i < n1; i++){
temp = myGerbils[i].name + " (" + (myGerbils[i].getLabID())+ ") " + (percentFood(i)) + "%" + "\n";
average = temp + average;
}
return average;
}
It calls upon another method in the string. When I run it, it goes fine up until it gets to the percentFood method; then, I get an error that looks like "[I@6158dd66". The percentFood Method looks like this:
public static int[] percentFood(int i){
int temp;
int temp2;
int[] ans = new int[n1];
for (int j = 0; j < n1; j++){
temp = myGerbils[i].getFoodCon(j);
temp2 = gerbilFood[j].getMaxAm();
ans[j] = (temp/temp2);
}
return ans;
}
Any ideas? Thanks!