generated from moocf/hello-world.java
-
Notifications
You must be signed in to change notification settings - Fork 0
count
Subhajit Sahu edited this page Mar 24, 2021
·
8 revisions
Counts no. of true values. 📰 📘
Can be used to implement one-hot / one-cold detector.
Boolean.count(a, b, ...)
// a: 1st boolean
// b: 2nd boolean
import io.github.javaf.*;
Boolean.count(true, true);
// 2
Boolean.count(true, false);
// 1
Boolean.count(true, true, true, false);
// 3 ^ ^ ^
Boolean.count(false, true, false, false);
// 1 ^