Sujay DSa
Sujay DSa

Reputation: 1192

Boolean expression into java

After creating a truth table I have arrived at the following expression

B(AC + aC + Ac) (lowercase represents NOT..meaning a means NOT A)

Is it possible to represent this in java without actually expanding this expression? Meaning without writing something like this?

if(B&&A&&C || B&&a&&C || B&&A&&c)

Upvotes: 0

Views: 69

Answers (1)

Eran
Eran

Reputation: 394136

If I understand your notation correctly, since the complement of AC + aC + Ac is ac, this expression can be simplified to

if (B && !(a && c))

which is equivalent to

if (B && (A || C))

Upvotes: 4

Related Questions