@Test public void testAlign() { assertEquals(4, Pow2.align(2, 4)); assertEquals(4, Pow2.align(4, 4)); }
public static long align(final long value, final int alignment) { if (!isPowerOfTwo(alignment)) { throw new IllegalArgumentException("alignment must be a power of 2:" + alignment); } return (value + (alignment - 1)) & ~(alignment - 1); }
Pow2 { public static long align(final long value, final int alignment) { if (!isPowerOfTwo(alignment)) { throw new IllegalArgumentException("alignment must be a power of 2:" + alignment); } return (value + (alignment - 1)) & ~(alignment - 1); } }
Pow2 { public static long align(final long value, final int alignment) { if (!isPowerOfTwo(alignment)) { throw new IllegalArgumentException("alignment must be a power of 2:" + alignment); } return (value + (alignment - 1)) & ~(alignment - 1); }  }
Pow2 { public static long align(final long value, final int alignment) { if (!isPowerOfTwo(alignment)) { throw new IllegalArgumentException("alignment must be a power of 2:" + alignment); } return (value + (alignment - 1)) & ~(alignment - 1); }  static int roundToPowerOfTwo(final int value); static boolean isPowerOfTwo(final int value); static long align(final long value, final int alignment); }
Pow2 { public static long align(final long value, final int alignment) { if (!isPowerOfTwo(alignment)) { throw new IllegalArgumentException("alignment must be a power of 2:" + alignment); } return (value + (alignment - 1)) & ~(alignment - 1); }  static int roundToPowerOfTwo(final int value); static boolean isPowerOfTwo(final int value); static long align(final long value, final int alignment); static final int MAX_POW2; }