< prev index next >

src/java.base/share/classes/java/lang/Integer.java

Print this page

        

*** 336,346 **** */ private static String toUnsignedString0(int val, int shift) { // 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); return new String(buf, LATIN1); } else { --- 336,345 ----
*** 475,485 **** * @implNote This method converts positive inputs into negative * values, to cover the Integer.MIN_VALUE case. Converting otherwise * (negative to positive) will expose -Integer.MIN_VALUE that overflows * integer. */ ! static void getChars(int i, int index, byte[] buf) { int q, r; int charPos = index; boolean negative = i < 0; if (!negative) { --- 474,484 ---- * @implNote This method converts positive inputs into negative * values, to cover the Integer.MIN_VALUE case. Converting otherwise * (negative to positive) will expose -Integer.MIN_VALUE that overflows * integer. */ ! static int getChars(int i, int index, byte[] buf) { int q, r; int charPos = index; boolean negative = i < 0; if (!negative) {
*** 506,518 **** } if (negative) { buf[--charPos] = (byte)'-'; } } ! static void getCharsUTF16(int i, int index, byte[] buf) { int q, r; int charPos = index; boolean negative = (i < 0); if (!negative) { --- 505,518 ---- } if (negative) { buf[--charPos] = (byte)'-'; } + return charPos; } ! static int getCharsUTF16(int i, int index, byte[] buf) { int q, r; int charPos = index; boolean negative = (i < 0); if (!negative) {
*** 539,548 **** --- 539,549 ---- } if (negative) { StringUTF16.putChar(buf, --charPos, '-'); } + return charPos; } // Left here for compatibility reasons, see JDK-8143900. static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE };
< prev index next >