Generate 2D array with set amount entries
boolean finished = false;
while (!finished) {
    finished = true;

    // check columns
    for (int x = 0; x &lt; width; x++) {
        if (generateTargetColumn(x, width, height, targetNumbers)) {
            finished = false;
        }
    }

    // check rows
    for (int y = 0; y &lt; height; y++) {
        if (generateTargetRow(y, width, height, targetNumbers)) {
            finished = false;
        }
    }
}



We're working with booleans here. I can directly assign the result to the variable...

boolean finished = false;
while (!finished) {
    finished = true;

    // check columns
    for (int x = 0; x &lt; width; x++) {
        finished = !generateTargetColumn(x, width, height, targetNumbers) &amp;&amp; finished;
    }

    // check rows
    for (int y = 0; y &lt; height; y++) {
        finished = !generateTargetRow(y, width, height, targetNumbers) &amp;&amp; finished;
    }
}


There's a lot of negations in here, so maybe we can flip the variable's meaning and get clearer code?

boolean busy = true;
while (busy) {
    busy = false;

    // check columns
    for (int x = 0; x &lt; width; x++) {
        busy = generateTargetColumn(x, width, height, targetNumbers) || busy;
    }

    // check rows
    for (int y = 0; y &lt; height; y++) {
        busy = generateTargetRow(y, width, height, targetNumbers) || busy;
    }
}


Sure, but "busy" is not really what we're looking for, after all, you say that

@return returns true if the column/row is regenerated.


So we should change the name to "gridChanged" or something like that.

boolean gridChanged = true;
while (gridChanged) {
    gridChanged = false;

    // check columns
    for (int x = 0; x &lt; width; x++) {
        gridChanged = generateTargetColumn(x, width, height, targetNumbers) || gridChanged;
    }

    // check rows
    for (int y = 0; y &lt; height; y++) {
        gridChanged = generateTargetRow(y, width, height, targetNumbers) || gridChanged;
    }
}


But now you have this weird thing where at the start, you say "I had changes", which seems wrong... and you always want to go in the loop at the start. So convert it to a do-while:

boolean gridChanged = true;
do {
    gridChanged = false;

    // check columns
    for (int x = 0; x &lt; width; x++) {
        gridChanged = generateTargetColumn(x, width, height, targetNumbers) || gridChanged;
    }

    // check rows
    for (int y = 0; y &lt; height; y++) {
        gridChanged = generateTargetRow(y, width, height, targetNumbers) || gridChanged;
    }
} while(gridChanged);