Java tutorial
//package com.java2s; import java.util.Stack; public class Main { private static char[] charSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".toCharArray(); public static String _10_to_62(long number, int length) { Long rest = number; Stack<Character> stack = new Stack<Character>(); StringBuilder result = new StringBuilder(0); while (rest != 0) { stack.add(charSet[new Long((rest - (rest / 62) * 62)).intValue()]); rest = rest / 62; } for (; !stack.isEmpty();) { result.append(stack.pop()); } int result_length = result.length(); StringBuilder temp0 = new StringBuilder(); for (int i = 0; i < length - result_length; i++) { temp0.append('0'); } return temp0.toString() + result.toString(); } }