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(final long value)
Convert a long into an ASM HEX representation
final StringBuilder result = new StringBuilder();
result.append(value).append("(#").append(Long.toHexString(value).toUpperCase()).append(')');
return result.toString();
StringlongToString(long l)
long To String
String bitString = Long.toBinaryString(l);
int padding = 64 - bitString.length();
String output = "";
while (padding > 0) {
    padding--;
    output += "0";
return output + bitString;
...
StringlongToString(long l)
long To String
if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) {
    return null;
if (l % 37L == 0L) {
    return null;
int i = 0;
char ac[] = new char[12];
...
StringLongToString(Long l, int length)
Long To String
char[] output = new char[length];
while (length-- > 0) {
    output[length] = int2Char((int) (l & 3));
    l >>= 2;
return new String(output);
StringlongToString(long li)
long To String
String str = "";
try {
    str = String.valueOf(li);
} catch (Exception e) {
return str;
StringlongToString(long longV)
Get a string presentation of the 64 bits in a long
StringBuilder result = new StringBuilder("{");
int counter = 0;
for (int ind = 63; ind >= 0; ind--) {
    if (getBitInLong(longV, ind) == 1) {
        result.append("1");
        counter++;
    } else {
        result.append("0");
...
StringlongToString(long longValue)
Convert long to string.
return new Long(longValue).toString();
StringlongToString(long longValue, boolean noCase)
long To String
char[] digits = noCase ? DIGITS_NOCASE : DIGITS;
int digitsLength = digits.length;
if (longValue == 0) {
    return String.valueOf(digits[0]);
if (longValue < 0) {
    longValue = -longValue;
StringBuilder strValue = new StringBuilder();
while (longValue != 0) {
    int digit = (int) (longValue % digitsLength);
    longValue = longValue / digitsLength;
    strValue.append(digits[digit]);
return strValue.toString();
StringlongToString(long n)
Returns a string of 16 hexadecimal digits (most significant digit first) corresponding to the long n, which is treated as unsigned.
char[] buf = new char[16];
for (int i = 15; i >= 0; i--) {
    buf[i] = hexDigits[(int) n & 0x0F];
    n >>>= 4;
return new String(buf);
byte[]LongToString(long number, boolean bcdFlag, int bufferSize)
Long To String
int size = (bufferSize > 0 ? bufferSize : 20);
byte[] buffer = new byte[size];
int length = LongToString(number, buffer, 0, size, bcdFlag);
if (bufferSize > 0)
    return buffer;
byte[] buf = new byte[length];
System.arraycopy(buffer, size - length, buf, 0, length);
buffer = null;
...