public static boolean isPower2(int x) {
        return x > 0 && (x & (x - 1)) == 0;
    }
@Test
    public void testIsPower2() {
        System.out.println("isPower2");
        assertFalse(MathEx.isPower2(-1));
        assertFalse(MathEx.isPower2(0));
        assertTrue(MathEx.isPower2(1));
        assertTrue(MathEx.isPower2(2));
        assertFalse(MathEx.isPower2(3));
        assertTrue(MathEx.isPower2(4));
        assertTrue(MathEx.isPower2(8));
        assertTrue(MathEx.isPower2(16));
        assertTrue(MathEx.isPower2(32));
        assertTrue(MathEx.isPower2(64));
        assertTrue(MathEx.isPower2(128));
        assertTrue(MathEx.isPower2(256));
        assertTrue(MathEx.isPower2(512));
        assertTrue(MathEx.isPower2(1024));
        assertTrue(MathEx.isPower2(65536));
        assertTrue(MathEx.isPower2(131072));
    }