jdk/src/java.base/share/classes/java/lang/Integer.java
changeset 32649 2ee9017c7597
parent 31671 362e0c0acece
child 33663 2cd62a4bd471
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
    74     public static final Class<Integer>  TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
    74     public static final Class<Integer>  TYPE = (Class<Integer>) Class.getPrimitiveClass("int");
    75 
    75 
    76     /**
    76     /**
    77      * All possible chars for representing a number as a String
    77      * All possible chars for representing a number as a String
    78      */
    78      */
    79     final static char[] digits = {
    79     static final char[] digits = {
    80         '0' , '1' , '2' , '3' , '4' , '5' ,
    80         '0' , '1' , '2' , '3' , '4' , '5' ,
    81         '6' , '7' , '8' , '9' , 'a' , 'b' ,
    81         '6' , '7' , '8' , '9' , 'a' , 'b' ,
    82         'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
    82         'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
    83         'i' , 'j' , 'k' , 'l' , 'm' , 'n' ,
    83         'i' , 'j' , 'k' , 'l' , 'm' , 'n' ,
    84         'o' , 'p' , 'q' , 'r' , 's' , 't' ,
    84         'o' , 'p' , 'q' , 'r' , 's' , 't' ,
   342             buf[--charPos] = Integer.digits[val & mask];
   342             buf[--charPos] = Integer.digits[val & mask];
   343             val >>>= shift;
   343             val >>>= shift;
   344         } while (charPos > offset);
   344         } while (charPos > offset);
   345     }
   345     }
   346 
   346 
   347     final static char [] DigitTens = {
   347     static final char [] DigitTens = {
   348         '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
   348         '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
   349         '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
   349         '1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
   350         '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
   350         '2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
   351         '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
   351         '3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
   352         '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
   352         '4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
   355         '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
   355         '7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
   356         '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
   356         '8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
   357         '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
   357         '9', '9', '9', '9', '9', '9', '9', '9', '9', '9',
   358         } ;
   358         } ;
   359 
   359 
   360     final static char [] DigitOnes = {
   360     static final char [] DigitOnes = {
   361         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   361         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   362         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   362         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   363         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   363         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   364         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   364         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   365         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   365         '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
   465         if (sign != 0) {
   465         if (sign != 0) {
   466             buf [--charPos] = sign;
   466             buf [--charPos] = sign;
   467         }
   467         }
   468     }
   468     }
   469 
   469 
   470     final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
   470     static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999,
   471                                       99999999, 999999999, Integer.MAX_VALUE };
   471                                       99999999, 999999999, Integer.MAX_VALUE };
   472 
   472 
   473     // Requires positive x
   473     // Requires positive x
   474     static int stringSize(int x) {
   474     static int stringSize(int x) {
   475         for (int i=0; ; i++)
   475         for (int i=0; ; i++)