Extract multi-byte integer in Motorola format (little endian).
321392
def s2n_motorola(string):
    """"""
    x = 0
    for c in string:
        x = (x << 8) | ord_(c)
    return x
1161725
private static String getDecodedStr(byte[] decBytes) {

		// prepare StringBuilder with capacity being the smallest power of 2
		// greater than decBytes.length*6
		int n = decBytes.length * 6;
		int capacity = leastPowerOf2GreaterThanOrEqualTo(n);
		StringBuilder decStr = new StringBuilder(capacity);

		for (int i = 0; i < decBytes.length; i++) {

			int decByte = decBytes[i];
			String bitStr = Integer.toBinaryString(decByte);

			int padding = Math.max(0, 6 - bitStr.length());

			for (int j = 0; j < padding; j++) {
				decStr.append('0');
			}

			for (int j = 0; j < 6 - padding; j++) {
				decStr.append(bitStr.charAt(j));
			}
		}
		return decStr.toString();
	}
560794
def int2str(num, radix=10, alphabet=BASE85):
    """"""
    return NumConv(radix, alphabet).int2str(num)
1034819
def bytes_to_int(b, order='big'):  # pragma: no cover
        """"""
        if six.PY2:
            # save the original type of b without having to copy any data
            _b = b.__class__()
            if order != 'little':
                b = reversed(b)

            if not isinstance(_b, bytearray):
                b = six.iterbytes(b)

            return sum(c << (i * 8) for i, c in enumerate(b))

        return int.from_bytes(b, order)
466831
def _readuintbe(self, length, start):
        """"""
        if length % 8:
            raise InterpretError("Big-endian integers must be whole-byte. "
                                 "Length = {0} bits.", length)
        return self._readuint(length, start)
970215
public int getBytesBigEndian(int i, int j) {
    int result = 0;
    for (int k = i; k < i + j; k++) {
      result += value.get(k).toUint();
      if (k + 1 < i + j)
        result <<= 8;
    }
    return result;
  }
809430
def byte_to_bitstring(byte):
    """"""
    assert 0 <= byte <= 0xff
    bits = [int(x) for x in list(bin(byte + 0x100)[3:])]
    return bits
446881
def tob32(val):
    """"""
    ret = bytearray(4)
    ret[0] = (val>>24)&M8
    ret[1] = (val>>16)&M8
    ret[2] = (val>>8)&M8
    ret[3] = val&M8
    return ret
1155441
public static int byteArrayToIntLE( byte[] data ) {
        ByteBuffer buffer = ByteBuffer.wrap(data);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        return buffer.getInt();
    }
385725
def str2int(num, radix=10, alphabet=BASE85):
    """"""
    return NumConv(radix, alphabet).str2int(num)
906552
def read_large_int(self, bits, signed=True):
        """"""
        return int.from_bytes(
            self.read(bits // 8), byteorder='little', signed=signed)
148338
def intToBin(i):
    
    # devide in two parts (bytes)
    i1 = i % 256
    i2 = int(i / 256)
    # make string (little endian)
    return chr(i1) + chr(i2)
700940
def extract_bits(self, val):
        """"""
        # Step one, extract the Most significant 4 bits of the CRC register
        thisval = self.high >> 4
        # XOR in the Message Data into the extracted bits
        thisval = thisval ^ val
        # Shift the CRC Register left 4 bits
        self.high = (self.high << 4) | (self.low >> 4)
        self.high = self.high & constants.BYTEMASK    # force char
        self.low = self.low << 4
        self.low = self.low & constants.BYTEMASK      # force char
        # Do the table lookups and XOR the result into the CRC tables
        self.high = self.high ^ self.LookupHigh[thisval]
        self.high = self.high & constants.BYTEMASK    # force char
        self.low = self.low ^ self.LookupLow[thisval]
        self.low = self.low & constants.BYTEMASK
11819
def _readintbe(self, length, start):
        """"""
        if length % 8:
            raise InterpretError("Big-endian integers must be whole-byte. "
                                 "Length = {0} bits.", length)
        return self._readint(length, start)
920633
public int getInt32() throws IOException
    {
        if (_isMotorolaByteOrder) {
            // Motorola - MSB first (big endian)
            return (getByte() << 24 & 0xFF000000) |
                   (getByte() << 16 & 0xFF0000) |
                   (getByte() << 8  & 0xFF00) |
                   (getByte()       & 0xFF);
        } else {
            // Intel ordering - LSB first (little endian)
            return (getByte()       & 0xFF) |
                   (getByte() << 8  & 0xFF00) |
                   (getByte() << 16 & 0xFF0000) |
                   (getByte() << 24 & 0xFF000000);
        }
    }
428883
def _get_int64(data, position, dummy0, dummy1, dummy2):
    """"""
    end = position + 8
    return Int64(_UNPACK_LONG(data[position:end])[0]), end
707540
def from_int(value):
        """"""
        if not isinstance(value, int):
            raise PyVLXException("value_has_to_be_int")
        if not Parameter.is_valid_int(value):
            raise PyVLXException("value_out_of_range")
        return bytes([value >> 8 & 255, value & 255])