1 30 31 34 package com.nightlabs.math; 35 36 39 public class Base62Coder 40 extends BaseNCoder 41 { 42 private static Base62Coder _sharedInstance = null; 43 44 48 public static Base62Coder sharedInstance() 49 { 50 if (_sharedInstance == null) 51 _sharedInstance = new Base62Coder(); 52 53 return _sharedInstance; 54 } 55 56 61 public Base62Coder() 62 { 63 char[] symbols = new char[62]; 64 char c = '0'; 65 for (int i = 0; i < 10; ++i) { 66 symbols[i] = c++; 67 } 68 c = 'A'; 69 for (int i = 10; i < 36; ++i) { 70 symbols[i] = c++; 71 } 72 c = 'a'; 73 for (int i = 36; i < 62; ++i) { 74 symbols[i] = c++; 75 } 76 77 init(symbols); 78 } 79 80 } 81 | Popular Tags |