Java Utililty Methods Base Encode

List of utility methods to do Base Encode

Description

The list of methods to do Base Encode are organized into topic(s).

Method

longtoBase(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;
...
LongtoBase10(final String base62)
to Base
return toBase10(new StringBuilder(base62).reverse().toString().toCharArray());
StringtoBase10(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();
...
StringtoBase10(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(" ");
...
StringtoBase10SuffixedString(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();
StringtoBase16(byte[] data)
to Base
return toBase16(data, 0, data.length);
StringtoBase16(int[] arr)
to Base
return toBase16(arr, ",");
voidToBase16(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));
StringtoBase2(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');
...
StringtoBase26(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;
...