List of utility methods to do Base Encode
long | toBase(long startMillis, long currentMillis, long baseMillis) to Base long low = downTo(currentMillis, baseMillis); long high = upTo(currentMillis, baseMillis); long ret = startMillis; while (ret <= low) { ret += baseMillis; while (ret >= high) { ret -= baseMillis; ... |
Long | toBase10(final String base62) to Base return toBase10(new StringBuilder(base62).reverse().toString().toCharArray()); |
String | toBase10(int[] arr) to Base StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { sb.append((arr[i])); if (i < arr.length - 1) { sb.append(" "); return sb.toString(); ... |
String | toBase10(int[] arr) to Base if (arr == null) { return ""; StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; i++) { sb.append((arr[i])); if (i < arr.length - 1) { sb.append(" "); ... |
String | toBase10SuffixedString(long n) to Base Suffixed String for (int i = 0; i < BASE_10_SUFFIXES.length; i++) { long d = (n / 1000) / BASE_10_DIVISORS[i]; if (d == 0) { return (n / BASE_10_DIVISORS[i]) + BASE_10_SUFFIXES[i]; throw new AssertionError(); |
String | toBase16(byte[] data) to Base return toBase16(data, 0, data.length);
|
String | toBase16(int[] arr) to Base return toBase16(arr, ","); |
void | ToBase16(StringBuilder str, byte[] data) To Base if (data == null) { throw new NullPointerException("data"); int length = data.length; for (int i = 0; i < length; ++i) { str.append(HexAlphabet.charAt((data[i] >> 4) & 15)); str.append(HexAlphabet.charAt(data[i] & 15)); |
String | toBase2(byte b) to Base StringBuilder buf = new StringBuilder(8); buf.append((b & (1 << 7)) == 0 ? '0' : '1'); buf.append((b & (1 << 6)) == 0 ? '0' : '1'); buf.append((b & (1 << 5)) == 0 ? '0' : '1'); buf.append((b & (1 << 4)) == 0 ? '0' : '1'); buf.append((b & (1 << 3)) == 0 ? '0' : '1'); buf.append((b & (1 << 2)) == 0 ? '0' : '1'); buf.append((b & (1 << 1)) == 0 ? '0' : '1'); ... |
String | toBase26(int number) Convert a number into base-26 using lower case letters. if (number < 0) throw new NumberFormatException("Negative number"); number = Math.abs(number); String converted = ""; do { int remainder = number % 26; converted = (char) (remainder + 'a') + converted; number = (number - remainder) / 26; ... |