I am writing a code using JavaFX that works with a Canvas to create fill Rectangles.
This code is based off of some physics research that I am doing.
The issue I am running into comes about when I run a nested for loop with a lot of logical if statements.
The code works for most cases, but doesn't work when isAngMomConservation == false and isParityConservation == false.
Here is the code:
for (int i = 0, k = finals - 1, finalVal = (finals - 1) / 2 * -1; i < finals; i++, k--, finalVal++) {
    for (int j = 0, initialVal = (initial - 1) / 2 * -1; j < initial; j++, initialVal++) {
        final int ii = i;
        final int jj = j;
        System.out.println("i: " + ii + ", j: " + jj);
        if (isHelicity == false) {
            if (isParityConservation && isAngMomConservation == false) {
                setisDependent(false, i, j);
                if (parity == 1 && ((i % 2 == 0 && orbital % 2 == 1) || (i % 2 == 1 && orbital % 2 == 0))) {
                    setisAllowed(true);
                }
                if (parity == -1 && ((i % 2 == 0 && orbital % 2 == 0) || (i % 2 == 1 && orbital % 2 == 1))) {
                    setisAllowed(true);
                }
            } else if (isAngMomConservation && isParityConservation == false) {
                if (i == j) {
                    setisAllowed(true);
                }
            } else if (isAngMomConservation && isParityConservation) {
                if (parity == 1 && i == j
                        && ((i % 2 == 0 && orbital % 2 == 1) || (i % 2 == 1 && orbital % 2 == 0))) {
                    setisAllowed(true);
                }
                if (parity == -1 && i == j
                        && ((i % 2 == 0 && orbital % 2 == 0) || (i % 2 == 1 && orbital % 2 == 1))) {
                    setisAllowed(true);
                }
            } else {
                setisAllowed(true);
            }
            if (isTimeReversal && isAngMomConservation == false) {
                if (j <= k) {
                    setisDependent(false, i, j);
                    setisDependent2(false);
                } else {
                    setisDependent(true, i, j);
                    setisDependent2(true);
                }
            } else if (isTimeReversal && isAngMomConservation) {
                if (j <= k) {
                    setisDependent(false, i, j);
                    setisDependent2(false);
                }
                if (i == j && j > k) {
                    setisDependent(true, i, j);
                    setisDependent2(true);
                }
            }
            if (isTimeReversal == false) {
                setisDependent(false, i, j);
                setisDependent2(false);
            }
        } else {
            if (isAngMomConservation && isParityConservation == false) {
                if (j / helicity == i) {
                    setisAllowed(true);
                }
            }
            if (isAngMomConservation == false && isParityConservation) {
            }
        }
        if ((i % 2 == 0 && orbital % 2 == 1) || (i % 2 == 1 && orbital % 2 == 0)) {
            gc[i][j].setFill(colors[0]);
        } else {
            gc[i][j].setFill(colors[1]);
        }
        if (isAllowed == false) {
            gc[i][j].setFill(colors[2]);
        }
        gc[i][j].fillRect((j % initial) * BOX_SIZE, (i % finals) * BOX_SIZE, BOX_SIZE, BOX_SIZE);
        gc[i][j].setStroke(colors[3]);
        gc[i][j].setLineWidth(1);
        gc[i][j].strokeRect((j % initial) * 50, (i % finals) * 50, 50, 50);
        if (isAllowed && isDependent2 == false) {
            gc[i][j].setFill(colors[2]);
            gc[i][j].setFont(new javafx.scene.text.Font(30));
            gc[i][j].fillText("X", ((j % initial) * 50) + 15, ((i % finals) * 50) + 35, 50);
        }
        setisAllowed(false);
    }
}
I hope that I have provided enough code for my question to be answered. I have setter methods that allow me to set the values of all the booleans. Thanks for taking a look at my code.
 
    