public static boolean getBit(byte value, int index) {
        // the length of byte should always be positive whiles less than 8
        if (index > 7 || index < 0) {
            return false;
        }

        return (value & (0x1 << index)) != 0;
    }
@Test
    public void testGetBit() {
        final byte[] number = new byte[] {1, 2, 4, 8, 16, 32, 64, -128};

        for (int i = 0; i < number.length; i++) {
            for (int j = 0; j < 8; j++) {
                assertThat(ByteOperator.getBit(number[i], j), is(i == j));
            }
        }
    }