mirror of
https://github.com/corda/corda.git
synced 2025-01-09 06:23:04 +00:00
avoid unecessary array copy in Long.toString
This commit is contained in:
parent
f80fb9b536
commit
605ddffa31
@ -66,7 +66,7 @@ public final class Long extends Number implements Comparable<Long> {
|
|||||||
|
|
||||||
char[] array = new char[size];
|
char[] array = new char[size];
|
||||||
|
|
||||||
int i = array.length - 1;
|
int i = size - 1;
|
||||||
for (long n = v; n != 0; n /= radix) {
|
for (long n = v; n != 0; n /= radix) {
|
||||||
long digit = n % radix;
|
long digit = n % radix;
|
||||||
if (negative) digit = -digit;
|
if (negative) digit = -digit;
|
||||||
@ -83,7 +83,7 @@ public final class Long extends Number implements Comparable<Long> {
|
|||||||
array[i] = '-';
|
array[i] = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
return new String(array);
|
return new String(array, 0, size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String toString(long v) {
|
public static String toString(long v) {
|
||||||
|
Loading…
Reference in New Issue
Block a user