def numberToByteArray(n, howManyBytes=None):
 if (howManyBytes == None):
  howManyBytes = numBytes(n)
 b = bytearray(howManyBytes)
 for count in range((howManyBytes - 1), (-1), (-1)):
  b[count] = int((n % 256))
  n >>= 8
 return b

def numberToByteArray ( n , howManyBytes = None ) : if ( howManyBytes == None ) : howManyBytes = numBytes ( n ) b = bytearray ( howManyBytes ) for count in range ( ( howManyBytes - 1 ) , ( - 1 ) , ( - 1 ) ) : b [ count ] = int ( ( n % 256 ) ) n >>= 8 return b
convert an integer into a bytearray .