< prev index next >

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

Print this page

        

*** 377,387 **** */ static String toUnsignedString0(long val, int shift) { // assert shift > 0 && shift <=5 : "Illegal shift value"; int mag = Long.SIZE - Long.numberOfLeadingZeros(val); int chars = Math.max(((mag + (shift - 1)) / shift), 1); - if (COMPACT_STRINGS) { byte[] buf = new byte[chars]; formatUnsignedLong0(val, shift, buf, 0, chars); return new String(buf, LATIN1); } else { --- 377,386 ----
*** 488,498 **** * @implNote This method converts positive inputs into negative * values, to cover the Long.MIN_VALUE case. Converting otherwise * (negative to positive) will expose -Long.MIN_VALUE that overflows * long. */ ! static void getChars(long i, int index, byte[] buf) { long q; int r; int charPos = index; boolean negative = (i < 0); --- 487,497 ---- * @implNote This method converts positive inputs into negative * values, to cover the Long.MIN_VALUE case. Converting otherwise * (negative to positive) will expose -Long.MIN_VALUE that overflows * long. */ ! static int getChars(long i, int index, byte[] buf) { long q; int r; int charPos = index; boolean negative = (i < 0);
*** 531,543 **** } if (negative) { buf[--charPos] = (byte)'-'; } } ! static void getCharsUTF16(long i, int index, byte[] buf) { long q; int r; int charPos = index; boolean negative = (i < 0); --- 530,543 ---- } if (negative) { buf[--charPos] = (byte)'-'; } + return charPos; } ! static int getCharsUTF16(long i, int index, byte[] buf) { long q; int r; int charPos = index; boolean negative = (i < 0);
*** 576,585 **** --- 576,586 ---- } if (negative) { StringUTF16.putChar(buf, --charPos, '-'); } + return charPos; } /** * Returns the string representation size for a given long value. *
< prev index next >