multiple code improvements: squid:S2293, squid:S1213, squid:S2185, squid:S1905, squid:S1226
This commit is contained in:
committed by
George Kankava
parent
732308bafe
commit
8bbddbe00a
@@ -11,7 +11,8 @@ public final class Yeast {
|
|||||||
private static char[] alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".toCharArray();
|
private static char[] alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".toCharArray();
|
||||||
|
|
||||||
private static int length = alphabet.length;
|
private static int length = alphabet.length;
|
||||||
|
private static int seed = 0;
|
||||||
|
private static String prev;
|
||||||
private static Map<Character, Integer> map = new HashMap<Character, Integer>(length);
|
private static Map<Character, Integer> map = new HashMap<Character, Integer>(length);
|
||||||
static {
|
static {
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
@@ -21,17 +22,13 @@ public final class Yeast {
|
|||||||
|
|
||||||
private Yeast () {}
|
private Yeast () {}
|
||||||
|
|
||||||
private static int seed = 0;
|
|
||||||
|
|
||||||
private static String prev;
|
|
||||||
|
|
||||||
public static String encode(long num) {
|
public static String encode(long num) {
|
||||||
final StringBuilder encoded = new StringBuilder();
|
final StringBuilder encoded = new StringBuilder();
|
||||||
|
long dividedNum;
|
||||||
do {
|
do {
|
||||||
encoded.insert(0, alphabet[(int)(num % length)]);
|
encoded.insert(0, alphabet[(int)(num % length)]);
|
||||||
num = (long)Math.floor(num / length);
|
dividedNum = num / length;
|
||||||
} while (num > 0);
|
} while (dividedNum > 0);
|
||||||
|
|
||||||
return encoded.toString();
|
return encoded.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user