How to convert 'unsigned long' to string in java

You need to use BigInteger unfortunately, or write your own routine.

Here is an Unsigned class which helps with these workarounds

private static final BigInteger BI_2_64 = BigInteger.ONE.shiftLeft(64);

public static String asString(long l) {
    return l >= 0 ? String.valueOf(l) : toBigInteger(l).toString();
}

public static BigInteger toBigInteger(long l) {
    final BigInteger bi = BigInteger.valueOf(l);
    return l >= 0 ? bi : bi.add(BI_2_64);
}

As mentioned in a different question on SO, there is a method for that starting with Java 8:

System.out.println(Long.toUnsignedString(Long.MAX_VALUE)); // 9223372036854775807
System.out.println(Long.toUnsignedString(Long.MIN_VALUE)); // 9223372036854775808

Can you use third-party libraries? Guava's UnsignedLongs.toString(long) does this.