Java Utililty Methods Long to String

List of utility methods to do Long to String

Description

The list of methods to do Long to String are organized into topic(s).

Method

StringlongToString(long val)
long To String
return Long.toHexString(val);
StringlongToString(long value)
long To String
StringBuilder sb = new StringBuilder();
for (int i = 0; i < LONG_ENC_STR_LEN; i++) {
    int remainder = (int) (value % printableChars.length);
    sb.insert(0, printableChars[Math.abs(remainder)]);
    value = value / printableChars.length;
    if ((i == 0) && (value < 0)) {
        value = value * 2;
return sb.toString();
StringlongToString(long value)
long To String
if (value == Integer.MIN_VALUE) {
    return "Integer.MIN_VALUE";
} else if (value == Integer.MAX_VALUE) {
    return "Integer.MAX_VALUE";
} else if (value == Long.MIN_VALUE) {
    return "Long.MIN_VALUE";
} else if (value == Long.MAX_VALUE) {
    return "Long.MAX_VALUE";
...
StringlongToString(Long value)
long To String
if (value == null) {
    return "00000000000000000000";
return String.format("%020d", value);
StringlongToString(long value)
Convert a Long number to a readable string.
return value >= 1e11 ? String.format("%.0fG", value / 1e9)
        : value >= 1e7 ? String.format("%.0fM", value / 1e6)
                : (value >= 1e4) ? String.format("%.0fK", value / 1e3) : Long.toString(value);
StringLongToString(long value)
Long To String
if (value == Long.MIN_VALUE) {
    return "-9223372036854775808";
if (value == 0) {
    return "0";
boolean neg = value < 0;
char[] chars = new char[24];
...
String[]longToString(long[] values)
long To String
if (values == null) {
    return null;
String[] results = new String[values.length];
for (int i = 0; i < values.length; i++) {
    results[i] = String.valueOf(values[i]);
return results;
...