@Test public void testDecodeManyZeros() { assertEquals(0, decodeBase32("0000000")); }
public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; }
Base32 { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; } }
Base32 { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; } private  Base32(); }
Base32 { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; } private  Base32(); static String encodeBase32(long i, int length); static String encodeBase32(long i); static long decodeBase32(String hash); }
Base32 { public static long decodeBase32(String hash) { boolean isNegative = hash.startsWith("-"); int startIndex = isNegative ? 1 : 0; long base = 1; long result = 0; for (int i = hash.length() - 1; i >= startIndex; i--) { int j = getCharIndex(hash.charAt(i)); result = result + base * j; base = base * 32; } if (isNegative) result *= -1; return result; } private  Base32(); static String encodeBase32(long i, int length); static String encodeBase32(long i); static long decodeBase32(String hash);  }