Lines Matching defs:radix

83      * radix specified by the second argument.
85 * <p>If the radix is smaller than {@code Character.MIN_RADIX}
86 * or larger than {@code Character.MAX_RADIX}, then the radix
107 * {@code '\u005Cu007a'}. If {@code radix} is
109 * are used as radix-<var>N</var> digits in the order shown. Thus,
110 * the digits for hexadecimal (radix 16) are
120 * @param radix the radix to use in the string representation.
121 * @return a string representation of the argument in the specified radix.
125 public static String toString(long i, int radix) {
126 if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
127 radix = 10;
128 if (radix == 10)
140 while (i <= -radix) {
141 buf[charPos--] = (byte)Integer.digits[(int)(-(i % radix))];
142 i = i / radix;
151 return toStringUTF16(i, radix);
154 private static String toStringUTF16(long i, int radix) {
161 while (i <= -radix) {
162 StringUTF16.putChar(buf, charPos--, Integer.digits[(int)(-(i % radix))]);
163 i = i / radix;
174 * unsigned integer value in the radix specified by the second
177 * <p>If the radix is smaller than {@code Character.MIN_RADIX}
178 * or larger than {@code Character.MAX_RADIX}, then the radix
193 * @param radix the radix to use in the string representation.
194 * @return an unsigned string representation of the argument in the specified radix.
198 public static String toUnsignedString(long i, int radix) {
200 return toString(i, radix);
202 switch (radix) {
232 return toUnsignedBigInteger(i).toString(radix);
408 int radix = 1 << shift;
409 int mask = radix - 1;
419 int radix = 1 << shift;
420 int mask = radix - 1;
464 * argument and the radix 10 were given as arguments to the {@link
488 * and returned as a string exactly as if the argument and radix
592 * radix specified by the second argument. The characters in the
593 * string must all be digits of the specified radix (as determined
607 * radix greater than or equal to 22.
616 * <li>The {@code radix} is either smaller than {@link
621 * radix, except that the first character may be a minus sign
645 * @param radix the radix to be used while parsing {@code s}.
647 * the specified radix.
651 public static long parseLong(String s, int radix)
658 if (radix < Character.MIN_RADIX) {
659 throw new NumberFormatException("radix " + radix +
662 if (radix > Character.MAX_RADIX) {
663 throw new NumberFormatException("radix " + radix +
686 long multmin = limit / radix;
690 int digit = Character.digit(s.charAt(i++),radix);
694 result *= radix;
708 * the specified {@code radix}, beginning at the specified
718 * @param radix the radix to be used while parsing {@code s}.
720 * the specified radix.
728 * {@code radix}, or if {@code radix} is either smaller than
733 public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix)
740 if (radix < Character.MIN_RADIX) {
741 throw new NumberFormatException("radix " + radix +
744 if (radix > Character.MAX_RADIX) {
745 throw new NumberFormatException("radix " + radix +
769 long multmin = limit / radix;
773 int digit = Character.digit(s.charAt(i), radix);
778 result *= radix;
799 * returned, exactly as if the argument and the radix {@code 10}
822 * radix specified by the second argument. An unsigned integer
827 * specified radix (as determined by whether {@link
839 * <li>The radix is either smaller than
844 * radix, except that the first character may be a plus sign
856 * @param radix the radix to be used while parsing {@code s}.
858 * argument in the specified radix.
863 public static long parseUnsignedLong(String s, int radix)
878 (radix == 10 && len <= 18) ) { // Long.MAX_VALUE in base 10 is 19 digits
879 return parseLong(s, radix);
883 long first = parseLong(s, 0, len - 1, radix);
884 int second = Character.digit(s.charAt(len - 1), radix);
888 long result = first * radix + second;
891 * Test leftmost bits of multiprecision extension of first*radix
894 * int guard = radix*(int)(first >>> (64 - GUARD_BIT)) and
899 * radix range.
901 int guard = radix * (int) (first >>> 57);
910 * If guard >= 128 then first*radix >= 2^7 * 2^57 = 2^64
916 * result <= (radix*left7)*2^57 + radix*(2^57 - 1) + second.
917 * Thus if radix*left7 < 92, radix <= 36, and second < 36,
922 * first*radix + second >= radix*left7*2^57 + second
923 * so that first*radix + second >= 92*2^57 + 0 > 2^63
926 * radix*first <= (radix*left7) * 2^57 + radix*(2^57 - 1)
928 * radix*first + second <= (radix*left7) * 2^57 + radix*(2^57 - 1) + 36
930 * radix*first + second < 128 * 2^57 + 36*2^57 - radix + 36
932 * radix*first + second < 2^64 + 2^6*2^57 = 2^64 + 2^63
936 * 2^63 < first*radix + second < 2^64 + 2^63. The lower
954 * the specified {@code radix}, beginning at the specified
964 * @param radix the radix to be used while parsing {@code s}.
966 * the specified radix.
974 * {@code radix}, or if {@code radix} is either smaller than
979 public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix)
995 (radix == 10 && len <= 18) ) { // Long.MAX_VALUE in base 10 is 19 digits
996 return parseLong(s, start, start + len, radix);
1000 long first = parseLong(s, start, start + len - 1, radix);
1001 int second = Character.digit(s.charAt(start + len - 1), radix);
1006 long result = first * radix + second;
1009 * Test leftmost bits of multiprecision extension of first*radix
1012 * int guard = radix*(int)(first >>> (64 - GUARD_BIT)) and
1017 * radix range.
1019 int guard = radix * (int) (first >>> 57);
1028 * If guard >= 128 then first*radix >= 2^7 * 2^57 = 2^64
1034 * result <= (radix*left7)*2^57 + radix*(2^57 - 1) + second.
1035 * Thus if radix*left7 < 92, radix <= 36, and second < 36,
1040 * first*radix + second >= radix*left7*2^57 + second
1041 * so that first*radix + second >= 92*2^57 + 0 > 2^63
1044 * radix*first <= (radix*left7) * 2^57 + radix*(2^57 - 1)
1046 * radix*first + second <= (radix*left7) * 2^57 + radix*(2^57 - 1) + 36
1048 * radix*first + second < 128 * 2^57 + 36*2^57 - radix + 36
1050 * radix*first + second < 2^64 + 2^6*2^57 = 2^64 + 2^63
1054 * 2^63 < first*radix + second < 2^64 + 2^63. The lower
1075 * is returned, exactly as if the argument and the radix 10 were
1093 * with the radix given by the second argument. The first
1095 * {@code long} in the radix specified by the second
1105 * {@code new Long(Long.parseLong(s, radix))}
1109 * @param radix the radix to be used in interpreting {@code s}
1112 * radix.
1116 public static Long valueOf(String s, int radix) throws NumberFormatException {
1117 return Long.valueOf(parseLong(s, radix));
1211 * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
1213 * Long.parseLong} method with the indicated radix (10, 16, or 8).
1229 int radix = 10;
1244 // Handle radix specifier, if present
1247 radix = 16;
1251 radix = 16;
1255 radix = 8;
1262 result = Long.valueOf(nm.substring(index), radix);
1270 result = Long.valueOf(constant, radix);
1304 * {@code parseLong} method for radix 10.
1531 * with radix 16.
1535 * #valueOf(java.lang.String, int)} with radix 8.
1538 * {@link #valueOf(java.lang.String, int)} with radix 10.