1
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.nl.common.utils;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/2/9 2:54 下午
|
||||
*/
|
||||
public class BaseCode {
|
||||
|
||||
static final char[] MySerials = new char[]{
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p','q','r','s','t','u','v','w','x','y','z',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P','Q','R','S','T','U','V','W','X','Y','Z'};
|
||||
|
||||
|
||||
public static final String intToChars(long n){
|
||||
String s = "";
|
||||
if (n == 0) {
|
||||
s = "0";
|
||||
}
|
||||
while (n != 0) {
|
||||
int i = (int) (n % MySerials.length);
|
||||
char c = MySerials[i];
|
||||
s = c + s;
|
||||
n = n / MySerials.length;
|
||||
}
|
||||
for (int x = s.length();x<5;x++){
|
||||
s="0"+s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user