Created
April 5, 2014 09:05
-
-
Save YusukeHosonuma/9989392 to your computer and use it in GitHub Desktop.
Javaですべてがtrue、1つでもtrueを判定する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// すべてがtrueか? | |
boolean flag = true; | |
for (boolean bit : bits) flag &= bit; | |
// 1つでもtrueか? | |
boolean flag = false; | |
for (boolean bit : bits) flag |= bit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment