--- old/src/java.base/share/classes/java/lang/Integer.java 2015-11-27 20:25:49.682403079 +0300 +++ new/src/java.base/share/classes/java/lang/Integer.java 2015-11-27 20:25:49.518403839 +0300 @@ -338,7 +338,6 @@ // assert shift > 0 && shift <=5 : "Illegal shift value"; int mag = Integer.SIZE - Integer.numberOfLeadingZeros(val); int chars = Math.max(((mag + (shift - 1)) / shift), 1); - if (COMPACT_STRINGS) { byte[] buf = new byte[chars]; formatUnsignedInt(val, shift, buf, 0, chars); @@ -476,8 +475,13 @@ * values, to cover the Integer.MIN_VALUE case. Converting otherwise * (negative to positive) will expose -Integer.MIN_VALUE that overflows * integer. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, Latin1-encoded + * @return index of the most significant digit or minus sign, if present */ - static void getChars(int i, int index, byte[] buf) { + static int getChars(int i, int index, byte[] buf) { int q, r; int charPos = index; @@ -508,9 +512,19 @@ if (negative) { buf[--charPos] = (byte)'-'; } + return charPos; } - static void getCharsUTF16(int i, int index, byte[] buf) { + /** + * This is a variant of {@link #getChars(int, int, byte[])}, but for + * UTF-16 coder. + * + * @param i value to convert + * @param index next index, after the least significant digit + * @param buf target buffer, UTF16-coded. + * @return index of the most significant digit or minus sign, if present + */ + static int getCharsUTF16(int i, int index, byte[] buf) { int q, r; int charPos = index; @@ -541,6 +555,7 @@ if (negative) { StringUTF16.putChar(buf, --charPos, '-'); } + return charPos; } // Left here for compatibility reasons, see JDK-8143900.