SHARE
TWEET

multiple of two

DulcetAirman Oct 6th, 2018 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     for (int x = 0; x < 100; x++) {
  2.       boolean notZero = x != 0;
  3.       int previous = x - 1;
  4.       int and = x & previous;
  5.       boolean isMultipleOfTwo = notZero && (and == 0);
  6.       System.out.println(String.format("%d = %s", x, isMultipleOfTwo));
  7.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top