private static int unsignedToSigned(int unsigned, int size) {
        if ((unsigned & (1 << size - 1)) != 0) {
            unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1)));
        }
        return unsigned;
    }
Convert an unsigned integer value to a two's-complement encoded
signed value.
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java