int attempts = 0;
boolean success = false;
while (!success
        && attempts < 3) {
    attempts++;
    // pretend this checks
    // a password guess
    success = (attempts == 2);
}
