Java Code Examples for com.google.common.math.LongMath#isPowerOfTwo()
The following examples show how to use
com.google.common.math.LongMath#isPowerOfTwo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuavaLongMathUnitTest.java From tutorials with MIT License | 4 votes |
@Test public void whenIsPowOfLong_shouldReturnTrueIfPowerOfTwo() { boolean result = LongMath.isPowerOfTwo(16L); assertTrue(result); }
Example 2
Source File: GuavaLongMathUnitTest.java From tutorials with MIT License | 4 votes |
@Test public void whenIsPowOfLong_shouldReturnFalseeIfNotPowerOfTwo() { boolean result = LongMath.isPowerOfTwo(20L); assertFalse(result); }
Example 3
Source File: MathUtil.java From vjtools with Apache License 2.0 | 2 votes |
/** * 是否2的倍数 * * @param value <=0 时总是返回false */ public static boolean isPowerOfTwo(long value) { return LongMath.isPowerOfTwo(value); }
Example 4
Source File: MathUtil.java From vjtools with Apache License 2.0 | 2 votes |
/** * 是否2的倍数 * * @param value <=0 时总是返回false */ public static boolean isPowerOfTwo(long value) { return LongMath.isPowerOfTwo(value); }
Example 5
Source File: MathUtil.java From j360-dubbo-app-all with Apache License 2.0 | 2 votes |
/** * 是否2的倍数 * * @param value <=0 时总是返回false */ public static boolean isPowerOfTwo(long value) { return LongMath.isPowerOfTwo(value); }