@Test
public void getBitTest() {

    byte[] data = ByteBuffer.allocate(4).putInt(0).array();
    ByteUtil.setBit(data, 24, 1);
    ByteUtil.setBit(data, 25, 1);
    ByteUtil.setBit(data, 2, 1);
    List<Integer> found = new ArrayList<>();
    for (int i = 0; i < (data.length * 8); i++) {
        int res = ByteUtil.getBit(data, i);
        if (res == 1)
            if (i != 24 && i != 25 && i != 2)
                assertTrue(false);
            else
                found.add(i);
        else {
            if (i == 24 || i == 25 || i == 2)
                assertTrue(false);
        }
    }
    if (found.size() != 3)
        assertTrue(false);
    assertTrue(found.get(0) == 2);
    assertTrue(found.get(1) == 24);
    assertTrue(found.get(2) == 25);
}