@@ -414,33 +414,6 @@ private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int l
414
414
} while (charPos > 0 );
415
415
}
416
416
417
- static final byte [] DigitTens = {
418
- '0' , '0' , '0' , '0' , '0' , '0' , '0' , '0' , '0' , '0' ,
419
- '1' , '1' , '1' , '1' , '1' , '1' , '1' , '1' , '1' , '1' ,
420
- '2' , '2' , '2' , '2' , '2' , '2' , '2' , '2' , '2' , '2' ,
421
- '3' , '3' , '3' , '3' , '3' , '3' , '3' , '3' , '3' , '3' ,
422
- '4' , '4' , '4' , '4' , '4' , '4' , '4' , '4' , '4' , '4' ,
423
- '5' , '5' , '5' , '5' , '5' , '5' , '5' , '5' , '5' , '5' ,
424
- '6' , '6' , '6' , '6' , '6' , '6' , '6' , '6' , '6' , '6' ,
425
- '7' , '7' , '7' , '7' , '7' , '7' , '7' , '7' , '7' , '7' ,
426
- '8' , '8' , '8' , '8' , '8' , '8' , '8' , '8' , '8' , '8' ,
427
- '9' , '9' , '9' , '9' , '9' , '9' , '9' , '9' , '9' , '9' ,
428
- } ;
429
-
430
- static final byte [] DigitOnes = {
431
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
432
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
433
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
434
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
435
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
436
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
437
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
438
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
439
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
440
- '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' ,
441
- } ;
442
-
443
-
444
417
/**
445
418
* Returns a {@code String} object representing the
446
419
* specified integer. The argument is converted to signed decimal
@@ -456,7 +429,7 @@ public static String toString(int i) {
456
429
int size = stringSize (i );
457
430
if (COMPACT_STRINGS ) {
458
431
byte [] buf = new byte [size ];
459
- getChars (i , size , buf );
432
+ StringLatin1 . getChars (i , size , buf );
460
433
return new String (buf , LATIN1 );
461
434
} else {
462
435
byte [] buf = new byte [size * 2 ];
@@ -483,53 +456,6 @@ public static String toUnsignedString(int i) {
483
456
return Long .toString (toUnsignedLong (i ));
484
457
}
485
458
486
- /**
487
- * Places characters representing the integer i into the
488
- * character array buf. The characters are placed into
489
- * the buffer backwards starting with the least significant
490
- * digit at the specified index (exclusive), and working
491
- * backwards from there.
492
- *
493
- * @implNote This method converts positive inputs into negative
494
- * values, to cover the Integer.MIN_VALUE case. Converting otherwise
495
- * (negative to positive) will expose -Integer.MIN_VALUE that overflows
496
- * integer.
497
- *
498
- * @param i value to convert
499
- * @param index next index, after the least significant digit
500
- * @param buf target buffer, Latin1-encoded
501
- * @return index of the most significant digit or minus sign, if present
502
- */
503
- static int getChars (int i , int index , byte [] buf ) {
504
- int q , r ;
505
- int charPos = index ;
506
-
507
- boolean negative = i < 0 ;
508
- if (!negative ) {
509
- i = -i ;
510
- }
511
-
512
- // Generate two digits per iteration
513
- while (i <= -100 ) {
514
- q = i / 100 ;
515
- r = (q * 100 ) - i ;
516
- i = q ;
517
- buf [--charPos ] = DigitOnes [r ];
518
- buf [--charPos ] = DigitTens [r ];
519
- }
520
-
521
- // We know there are at most two digits left at this point.
522
- buf [--charPos ] = DigitOnes [-i ];
523
- if (i < -9 ) {
524
- buf [--charPos ] = DigitTens [-i ];
525
- }
526
-
527
- if (negative ) {
528
- buf [--charPos ] = (byte )'-' ;
529
- }
530
- return charPos ;
531
- }
532
-
533
459
/**
534
460
* Returns the string representation size for a given int value.
535
461
*
0 commit comments