class BitBufferHelper {

    public static short getShort(byte[] data, int numBits) {
        if (numBits > Short.SIZE) {
            LOG.error("getShort", new BufferException("Container is too small for the number of requested bits"));
        }
        int startOffset = data.length * NetUtils.NUM_BITS_IN_A_BYTE - numBits;
        byte[] bits = null;
        try {
            bits = getBits(data, startOffset, numBits);
        } catch (BufferException e) {
            LOG.error("getBits failed", e);
            return 0;
        }
        return (short) toNumber(bits, numBits);
    }

    private  BitBufferHelper();

}