Skip to content

Instantly share code, notes, and snippets.

@YusukeHosonuma
Created April 5, 2014 09:05
Show Gist options
  • Save YusukeHosonuma/9989392 to your computer and use it in GitHub Desktop.
Save YusukeHosonuma/9989392 to your computer and use it in GitHub Desktop.
Javaですべてがtrue、1つでもtrueを判定する
// すべてが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