So I have a program that deals with bytes. Everything works, except one part. A for loop doesn’t execute at all.
This is the code…complex it is.
public int getID(int slot){
int slots = 0;
for(int a=0;a<b.length;a++){
if(correctslot){ //condition not shown.
if(slots==slot){
System.out.println("found pair");
for(int i=a;i<37;i++){
System.out.println("executing loop");
if(isID){ //condition not shown.
System.out.println("returning location");
return i+1;
}
}
}
slots++;
}
}
return 0;
}
If the program found a matching slot, it prints found pair. If it was executing the loop it prints executing loop, but that’s the part that doesn’t do anything at all. It prints the first string found pair but not the second executing loop. What did I do wrong?
Debug
a. I thinka >= 37by the time eithercorrectSlot && slots == slot.