Lines Matching refs:string

93      * Constructs a new {@code Integer} from the specified string.
95 * @param string
96 * the string representation of an integer value.
98 * if {@code string} cannot be parsed as an integer value.
101 public Integer(String string) throws NumberFormatException {
102 this(parseInt(string));
142 * Parses the specified string and returns a {@code Integer} instance if the
143 * string can be decoded into an integer value. The string may be an
147 * @param string
148 * a string representation of an integer value.
150 * {@code string}.
152 * if {@code string} cannot be parsed as an integer value.
154 public static Integer decode(String string) throws NumberFormatException {
155 int length = string.length(), i = 0;
157 throw invalidInt(string);
159 char firstDigit = string.charAt(i);
163 throw invalidInt(string);
165 firstDigit = string.charAt(++i);
173 if ((firstDigit = string.charAt(i)) == 'x' || firstDigit == 'X') {
175 throw invalidInt(string);
183 throw invalidInt(string);
188 int result = parse(string, i, base, negative);
219 * {@code string}. Returns {@code null} if {@code string} is {@code null}
223 * @param string
228 public static Integer getInteger(String string) {
229 if (string == null || string.length() == 0) {
232 String prop = System.getProperty(string);
245 * {@code string}. Returns the specified default value if {@code string} is
249 * @param string
257 public static Integer getInteger(String string, int defaultValue) {
258 if (string == null || string.length() == 0) {
261 String prop = System.getProperty(string);
274 * {@code string}. Returns the specified default value if {@code string} is
278 * @param string
286 public static Integer getInteger(String string, Integer defaultValue) {
287 if (string == null || string.length() == 0) {
290 String prop = System.getProperty(string);
322 * Parses the specified string as a signed decimal integer value. The ASCII
325 * @param string
326 * the string representation of an integer value.
327 * @return the primitive integer value represented by {@code string}.
329 * if {@code string} cannot be parsed as an integer value.
331 public static int parseInt(String string) throws NumberFormatException {
332 return parseInt(string, 10);
336 * Parses the specified string as a signed integer value using the specified
339 * @param string
340 * the string representation of an integer value.
343 * @return the primitive integer value represented by {@code string} using
346 * if {@code string} cannot be parsed as an integer value,
350 public static int parseInt(String string, int radix) throws NumberFormatException {
354 if (string == null) {
355 throw invalidInt(string);
357 int length = string.length(), i = 0;
359 throw invalidInt(string);
361 boolean negative = string.charAt(i) == '-';
363 throw invalidInt(string);
366 return parse(string, i, radix, negative);
369 private static int parse(String string, int offset, int radix, boolean negative) throws NumberFormatException {
371 int result = 0, length = string.length();
373 int digit = Character.digit(string.charAt(offset++), radix);
375 throw invalidInt(string);
378 throw invalidInt(string);
382 throw invalidInt(string);
389 throw invalidInt(string);
401 * Converts the specified integer into its binary string representation. The
402 * returned string is a concatenation of '0' and '1' characters.
406 * @return the binary string representation of {@code i}.
413 * Converts the specified integer into its hexadecimal string
414 * representation. The returned string is a concatenation of characters from
419 * @return the hexadecimal string representation of {@code i}.
426 * Converts the specified integer into its octal string representation. The
427 * returned string is a concatenation of characters from '0' to '7'.
431 * @return the octal string representation of {@code i}.
443 * Converts the specified integer into its decimal string representation.
444 * The returned string is a concatenation of a minus sign if the number is
449 * @return the decimal string representation of {@code i}.
456 * Converts the specified signed integer into a string representation based on the
457 * specified radix. The returned string is a concatenation of a minus sign
472 * @return the string representation of {@code i}.
479 * Parses the specified string as a signed decimal integer value.
481 * @param string
482 * the string representation of an integer value.
484 * represented by {@code string}.
486 * if {@code string} cannot be parsed as an integer value.
489 public static Integer valueOf(String string) throws NumberFormatException {
490 return valueOf(parseInt(string));
494 * Parses the specified string as a signed integer value using the specified
497 * @param string
498 * the string representation of an integer value.
502 * represented by {@code string} using {@code radix}.
504 * if {@code string} cannot be parsed as an integer value, or
509 public static Integer valueOf(String string, int radix) throws NumberFormatException {
510 return valueOf(parseInt(string, radix));