I want to return the value of i, but I don't know how. My code is:
public int indexOfFile(String filename) {
int value=0;
for(int i=0; i<DRIVE_SIZE; i++) {
if(drive[i]!=null && drive[i].getName().equals(filename)) {
value= i;
}else{
value= -1;
}
}
return value;
}
so I want the value of i, but no matter what I do, all I get is -1. Can someone show me what I'm doing wrong?