public class UrlShortener
{
    private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    private static final int    BASE     = 62;

	/**
	 * Encodes a numeric key as a short alphanumeric value.
	 *
	 * @param   num the key to encode
	 * @return  the alphanumeric value
	 */
    public static String encode(int num)
    {
        StringBuilder sb = new StringBuilder();

        while ( num > 0 )
        {
            sb.append( ALPHABET.charAt( num % BASE ) );
            num /= BASE;
        }

       return sb.reverse().toString();
    }

	/**
	 * Decodes an alphanumeric value into its numeric key.
	 *
	 * @param   str the String to decode
	 * @return  the decoded key
	 */
	public static int decode(String str)
    {
        int num = 0;inty=0;

        for ( int i = 0, len = str.length(); i < len; i++ )
        {
            num = num * BASE + ALPHABET.indexOf( str.charAt(i) );
        }

        return num;
    }
}
@@ -23,20 +23,17 @@
 ner%0D%0A%7B%0D%0A
-    
+%09
 private 
@@ -130,20 +130,17 @@
 6789%22;%0D%0A
-    
+%09
 private 
@@ -184,17 +184,16 @@
 %0A%09/**%0D%0A%09
- 
 * Encode
@@ -237,30 +237,28 @@
 ic value.%0D%0A%09
- 
 *%0D%0A%09
- 
 * @param   n
@@ -276,25 +276,24 @@
 to encode%0D%0A%09
- 
 * @return  t
@@ -320,17 +320,13 @@
 e%0D%0A%09
- 
 */%0D%0A
-    
+%09
 publ
@@ -359,31 +359,22 @@
 t num)%0D%0A
-    %7B%0D%0A        
+%09%7B%0D%0A%09%09
 StringBu
@@ -408,24 +408,18 @@
 r();%0D%0A%0D%0A
-        
+%09%09
 while ( 
@@ -429,39 +429,24 @@
  %3E 0 )%0D%0A
-        %7B%0D%0A            
+%09%09%7B%0D%0A%09%09%09
 sb.appen
@@ -482,28 +482,19 @@
 E ) );%0D%0A
-            
+%09%09%09
 num /= B
@@ -499,36 +499,24 @@
  BASE;%0D%0A
-        %7D%0D%0A%0D%0A       
+%09%09%7D%0D%0A%0D%0A%09
 return s
@@ -540,20 +540,17 @@
 ing();%0D%0A
-    
+%09
 %7D%0D%0A%0D%0A%09/*
@@ -553,17 +553,16 @@
 %0A%09/**%0D%0A%09
- 
 * Decode
@@ -613,14 +613,12 @@
 .%0D%0A%09
- 
 *%0D%0A%09
- 
 * @p
@@ -651,17 +651,16 @@
 ecode%0D%0A%09
- 
 * @retur
@@ -680,17 +680,16 @@
 d key%0D%0A%09
- 
 */%0D%0A%09pub
@@ -723,31 +723,22 @@
 g str)%0D%0A
-    %7B%0D%0A        
+%09%7B%0D%0A%09%09
 int num 
@@ -752,24 +752,18 @@
 y=0;%0D%0A%0D%0A
-        
+%09%09
 for ( in
@@ -811,31 +811,16 @@
  )%0D%0A
-        %7B%0D%0A            
+%09%09%7B%0D%0A%09%09%09
 num 
@@ -874,29 +874,17 @@
 );%0D%0A
-        %7D%0D%0A%0D%0A        
+%09%09%7D%0D%0A%0D%0A%09%09
 retu
@@ -892,16 +892,13 @@
 n num;%0D%0A
-    
+%09
 %7D%0D%0A%7D

Update src/UrlShortener.java