All values of boolean-triple Let a,b,c be a boolean value. I need to print all values of expression a &amp;&amp; b &amp;&amp; c. I'm writing the class

public class BooleanTriple{
    private boolean a,b,c;
    public BooleanTriple(boolean a, boolean b, boolean c){ this.a =a; this.b=b; this.c=c;}

    /**
    *Increments the value of triple with lexicographical ordering
    */
    public void incr(){
        if (!a) a=true;
        else if(!b){
            a= false;
            b= true;
        else if (!c){
            a= false;        
            b= false;
            c=true;  
        }
    }
    public boolean logProduct(){ return a &amp;&amp; b &amp;&amp; c;}
}


And Main class:

public class Main{
    BooleanTriple bTriple = new BooleanTriple(false,false,false);
    public static void main(String[] args){
        for (int i=0; i&lt;8; i++){
            System.out.println(bTriple.logProduct());
            bTriple.incr();
        }
    }
}


But i think, that it's bad implementation. Can you correct me?
I'll give you a hint. Think of a &amp;&amp; b &amp;&amp; c as a 3 digit binary number 

So all possibles values will be:

a | b | c
0 | 0 | 0
0 | 0 | 1
0 | 1 | 0
0 | 1 | 1
1 | 0 | 0
1 | 0 | 1
1 | 1 | 0
1 | 1 | 1


As you can see, you want to flip c every time and check the value of a and b to determine what they will be. b will change any time c is 1 and a will change any time b and c are 1. This should be enough to give you a better implementation.