From 605ddffa31f8b8b7473f320d7f344f9c13a10fa5 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 26 Apr 2009 12:46:55 -0600 Subject: [PATCH] avoid unecessary array copy in Long.toString --- classpath/java/lang/Long.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classpath/java/lang/Long.java b/classpath/java/lang/Long.java index 272c4365a9..279a8220ed 100644 --- a/classpath/java/lang/Long.java +++ b/classpath/java/lang/Long.java @@ -66,7 +66,7 @@ public final class Long extends Number implements Comparable { char[] array = new char[size]; - int i = array.length - 1; + int i = size - 1; for (long n = v; n != 0; n /= radix) { long digit = n % radix; if (negative) digit = -digit; @@ -83,7 +83,7 @@ public final class Long extends Number implements Comparable { array[i] = '-'; } - return new String(array); + return new String(array, 0, size, false); } public static String toString(long v) {