while-loop stopping on first loop
I have this code that is attempting to generate a code consisting of two 2 digit numbers (eg 56,27 ... 17,81 etc) between 10 and 99 that it sends to a validation class which returns if it is correct. I need the loop to continue attempting all possibilities until the connectionmanager class returns that it is correct, then it needs to stop.
Here's what I have so far
Code:
public class openspaceship
{
public static void main(String[] args)
{
connectionmanager conn = new connectionmanager();
combination comb = new combination();
int i = 10;
while (i <= 99)
{
int j = 10;
while (j <= 99)
{
comb.setCombo(i, j);
if (conn.openDoor(comb))
{
System.out.println("Door opened, combination is " + i + j);
}
j++;
}
i++;
}
}
}
I tried putting a System.println above the set combo, and what it did was say 10,10 every time which makes me think that it is only looping once and not adding 1 to each value.
The problem is that It will never find the code and always gets it wrong stopping after one loop.
Can someone please amend this to function correctly. Or give some advice.
Thanks