-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSJavaTMP.java
More file actions
26 lines (20 loc) · 803 Bytes
/
SJavaTMP.java
File metadata and controls
26 lines (20 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
public class SJavaTMP {
private static final long MODULAR_UNIT = 62;
private static final char[] BASE62_SHUFFLE_UNIT = "m9baosDF3VwpzMAPvNfjSHYuyGZBQl0x1U2ERdc5KT7I68WX4rkhqtJCOngLie".toCharArray();
public static void main(String[] args) throws IOException {
int LINK_SIZE=7;
Long linkId=1000000000L;
char[] shortenLink = new char[LINK_SIZE];
for(int index = 0; index < LINK_SIZE; index++){
shortenLink[index] = BASE62_SHUFFLE_UNIT[(int) (linkId%MODULAR_UNIT)];
linkId /= MODULAR_UNIT;
}
System.out.println(String.valueOf(shortenLink));
for(Character c: BASE62_SHUFFLE_UNIT){
System.out.print(c);
}
}
}