public static int roundToPowerOfTwo(final int value) {
        if (value > MAX_POW2) {
            throw new IllegalArgumentException("There is no larger power of 2 int for value:"+value+" since it exceeds 2^31.");
        }
        if (value < 0) {
            throw new IllegalArgumentException("Given value:"+value+". Expecting value >= 0.");
        }
        final int nextPow2 = 1 << (32 - Integer.numberOfLeadingZeros(value - 1));
        return nextPow2;
    }
@Test
    public void testRound()
    {
        assertEquals(4, Pow2.roundToPowerOfTwo(4));
        assertEquals(4, Pow2.roundToPowerOfTwo(3));
        assertEquals(1, Pow2.roundToPowerOfTwo(0));
        assertEquals(MAX_POSITIVE_POW2, Pow2.roundToPowerOfTwo(MAX_POSITIVE_POW2));
    }