diff options
Diffstat (limited to 'java/lang/Integer.java')
-rw-r--r-- | java/lang/Integer.java | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/java/lang/Integer.java b/java/lang/Integer.java index c63b0d55..f742505a 100644 --- a/java/lang/Integer.java +++ b/java/lang/Integer.java @@ -70,8 +70,6 @@ public final class Integer extends Number implements Comparable<Integer> { * @since JDK1.1 */ @SuppressWarnings("unchecked") - // Android-changed: Avoid use of removed Class.getPrimitiveClass method. - // public static final Class<Integer> TYPE = (Class<Integer>) Class.getPrimitiveClass("int"); public static final Class<Integer> TYPE = (Class<Integer>) int[].class.getComponentType(); /** @@ -317,8 +315,7 @@ public final class Integer extends Number implements Comparable<Integer> { formatUnsignedInt(val, shift, buf, 0, chars); - // Android-changed: Use regular constructor instead of one which takes over "buf". - // return new String(buf, true); + // Use special constructor which takes over "buf". return new String(buf); } @@ -343,10 +340,8 @@ public final class Integer extends Number implements Comparable<Integer> { return charPos; } - // BEGIN Android-changed: Cache the toString() result for small values. private static final String[] SMALL_NEG_VALUES = new String[100]; private static final String[] SMALL_NONNEG_VALUES = new String[100]; - // END Android-changed: Cache the toString() result for small values. final static char [] DigitTens = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', @@ -407,8 +402,7 @@ public final class Integer extends Number implements Comparable<Integer> { if (i == Integer.MIN_VALUE) return "-2147483648"; - // BEGIN Android-changed: Cache the String for small values. - // int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i); + // Android-changed: cache the string literal for small values. boolean negative = i < 0; boolean small = negative ? i > -100 : i < 100; if (small) { @@ -430,12 +424,10 @@ public final class Integer extends Number implements Comparable<Integer> { } return smallValues[i]; } + int size = negative ? stringSize(-i) + 1 : stringSize(i); - // END Android-changed: Cache the String for small values. char[] buf = new char[size]; getChars(i, size, buf); - // Android-changed: Use regular constructor instead of one which takes over "buf". - // return new String(buf, true); return new String(buf); } @@ -575,7 +567,6 @@ public final class Integer extends Number implements Comparable<Integer> { */ if (s == null) { - // Android-changed: Improve exception message for parseInt. throw new NumberFormatException("s == null"); } |