Convert a number (base10) to base62 encoded string

@param number the number to convert
@return the base 62 encoded string
498289
public static String encode(long number) {
		char[] output = new char[32];
		int p = 31;
		long n = number;
		while (n > 61) {
			output[p--] = encodingChars[(int) (n % 62L)];
			n = n / 62;
		}
		output[p] = encodingChars[(int) (n % 62L)];
		return new String(output, p, 32 - p);
	}
1056678
private function numToString(BigNumber $number) : string
    {
        $output = '';
        while ($number->getValue() > 0) {
            $previousNumber = clone $number;
            $number = $number->divide($this->alphabetLength);
            $digit = $previousNumber->mod($this->alphabetLength);

            $output .= $this->alphabet[(int)$digit->getValue()];
        }

        return $output;
    }
69209
def bban_base10(number):
    '''
    
    '''
    number = bban_compact(number)
    number = number[4:] + number[:4]
    return ''.join([str(IBAN_ALPHABET.index(char)) for char in number])
406478
public String castToPrintableMessage(long number) {
        long i = number / 1048576;
        if (i > 0)
            return String.valueOf(i) + " MB";

        else {
            long l = number / 1024;
            return String.valueOf(l) + " KB";
        }

    }
1279724
public static function mod10($number)
    {
        $checksum = '';
        foreach (str_split(strrev((string) $number)) as $i => $d) {
            $checksum .= ($i % 2 == 0) ? $d * 2 : $d;
        }
        return array_sum(str_split($checksum)) * 9 % 10;
    }
519459
def base36encode(number):
    """"""

    ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"

    base36 = ''
    sign = ''

    if number < 0:
        sign = '-'
        number = -number

    if 0 <= number < len(ALPHABET):
        return sign + ALPHABET[number]

    while number != 0:
        number, i = divmod(number, len(ALPHABET))
        base36 = ALPHABET[i] + base36

    return sign + base36
838620
public static function numberToString($number = NULL)
	{
		if($number === NULL)
		{
			throw new JSONException('Null pointer');
		}
		
		self::testValidity($number);
		
		// Shave off trailing zeros and decimal point, if possible.
		$number = (string) $number;
		if(strpos($number, '.') > 0 && strpos($number, 'e') < 0 && strpos($number, 'E') < 0)
		{
			while(substr($number, -1) == '0')
			{
				$number = substr(0, strlen($number) - 1);
			}
			
			if(substr($number, -1) == '.')
			{
				$number = substr(0, strlen($number) - 1);
			}
		}
		
		return $number;
	}
730440
def int_to_key(value, base=BASE62):
    
    def key_sequence_generator(value, base):
        """
        Generator for producing sequence of characters of a key providing an
        integer value and a base of characters for encoding, such as Base62
        for instance.

        @param value: a positive integer.
        @param base: a sequence of characters that is used to encode the
               integer value.

        @return: the next character of the object's key encoded with the
                 specified base.
            """
        base_length = len(base)
        while True:
            yield base[value % base_length]
            if value < base_length:
                break
            value /= base_length

    return ''.join([ c for c in key_sequence_generator(value, base) ])
692428
private final static String basePhoneNumber(String number) throws ParseException {
		StringBuffer s = new StringBuffer();
		Lexer lexer = new Lexer("sip_urlLexer", number);
		
		int lc = 0;
		while (lexer.hasMoreChars()) {
			char w = lexer.lookAhead(0);
			if (Lexer.isDigit(w)
				|| w == '-'
				|| w == '.'
				|| w == '('
				|| w == ')') {
				lexer.consume(1);
				s.append(w);
				lc++;
			}
//				else if (lc > 0)
//					break;
			else
				throw new IllegalArgumentException("unexpected " + w + " in the phone number");
		}
		return s.toString();

	}
858996
public static function toBase($num, $b = 62): string
    {
        $base = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $r = $num % $b;
        $res = $base[$r];
        $q = floor($num / $b);
        while ($q) {
            $r = $q % $b;
            $q = floor($q / $b);
            $res = $base[$r] . $res;
        }
        return $res;
    }
626610
function convertToBase64(input) {
        var result = "";
        var charCodes = getExpandedCharCodes(input);
        var i = 0;
        var length = charCodes.length;
        var byte1, byte2, byte3, byte4;
        while (i < length) {
            // Convert every 6-bits in the input 3 character points
            // into a base64 digit
            byte1 = charCodes[i] >> 2;
            byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4;
            byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6;
            byte4 = charCodes[i + 2] & 63;
            // We are out of characters in the input, set the extra
            // digits to 64 (padding character).
            if (i + 1 >= length) {
                byte3 = byte4 = 64;
            }
            else if (i + 2 >= length) {
                byte4 = 64;
            }
            // Write to the output
            result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4);
            i += 3;
        }
        return result;
    }
529622
protected String parseNumberToString(Number number, Context context, Arguments args)
    {
        final NumberFormat numberFormat = parseFormatter(context, args);

        final Currency currency = context.get(Contexts.CURRENCY);
        if (currency != null)
        {
            numberFormat.setCurrency(currency);
        }

        return numberFormat.format(number);
    }
1280428
public static String _char(EvaluationContext ctx, Object number) {
        return "" + (char) Conversions.toInteger(number, ctx);
    }
441564
private String _encode(long... numbers) {
        long numberHashInt = 0;
        for (int i = 0; i < numbers.length; i++) {
            numberHashInt += (numbers[i] % (i + 100));
        }
        String     alphabet = this.alphabet;
        final char ret      = alphabet.charAt((int) (numberHashInt % alphabet.length()));

        long                num;
        long                sepsIndex, guardIndex;
        String              buffer;
        final StringBuilder ret_strB = new StringBuilder(this.minHashLength);
        ret_strB.append(ret);
        char guard;

        for (int i = 0; i < numbers.length; i++) {
            num = numbers[i];
            buffer = ret + this.salt + alphabet;

            alphabet = Hashids.consistentShuffle(alphabet, buffer.substring(0, alphabet.length()));
            final String last = Hashids.hash(num, alphabet);

            ret_strB.append(last);

            if (i + 1 < numbers.length) {
                if (last.length() > 0) {
                    num %= (last.charAt(0) + i);
                    sepsIndex = (int) (num % this.seps.length());
                } else {
                    sepsIndex = 0;
                }
                ret_strB.append(this.seps.charAt((int) sepsIndex));
            }
        }

        String ret_str = ret_strB.toString();
        if (ret_str.length() < this.minHashLength) {
            guardIndex = (numberHashInt + (ret_str.charAt(0))) % this.guards.length();
            guard = this.guards.charAt((int) guardIndex);

            ret_str = guard + ret_str;

            if (ret_str.length() < this.minHashLength) {
                guardIndex = (numberHashInt + (ret_str.charAt(2))) % this.guards.length();
                guard = this.guards.charAt((int) guardIndex);

                ret_str += guard;
            }
        }

        final int halfLen = alphabet.length() / 2;
        while (ret_str.length() < this.minHashLength) {
            alphabet = Hashids.consistentShuffle(alphabet, alphabet);
            ret_str = alphabet.substring(halfLen) + ret_str + alphabet.substring(0, halfLen);
            final int excess = ret_str.length() - this.minHashLength;
            if (excess > 0) {
                final int start_pos = excess / 2;
                ret_str = ret_str.substring(start_pos, start_pos + this.minHashLength);
            }
        }

        return ret_str;
    }
829608
public static String getBinaryStr(Number number) {
		if (number instanceof Long) {
			return Long.toBinaryString((Long) number);
		} else if (number instanceof Integer) {
			return Integer.toBinaryString((Integer) number);
		} else {
			return Long.toBinaryString(number.longValue());
		}
	}
1191226
private Number parseNumber(String string) {
		if (string.length() > 2 && string.charAt(0) == '0' && string.charAt(1) == 'x') {
			return Long.parseLong(string.substring(2), 16);
		}
		return Double.parseDouble(string);
	}
367657
public String encode(long... numbers) {
        if (numbers.length == 0) {
            return "";
        }

        for (final long number : numbers) {
            if (number < 0) {
                return "";
            }
            if (number > MAX_NUMBER) {
                throw new IllegalArgumentException("number can not be greater than " + MAX_NUMBER + "L");
            }
        }
        return this._encode(numbers);
    }