/**
 * Take a number apart into its digits.
 *
 * @param number the number to take apart into digits.
 * @param maxDigits maximum number of digits you wish returned.
 * @param base usually 10, which number base to use.
 * @return byte[] containing digits 0..base-1, least significant first,
 * Note it does not return characters, but signed byte numbers.
 */
static byte [] splitIntoDigits ( long number, int maxDigits, int base )
   {
   // byte array, least significant digit first, initialised to zeros.
   byte[] digits = new byte[maxDigits];
   // work right to left, peeling off digits.
   for ( int i=0; i<maxDigits; i++ )
      {
      if ( number == 0 ) break;
      digits [i]= (byte)( number % base );
      number /= base;
      }
   return digits;
   }