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));
141 * Parses the specified string and returns a {@code Integer} instance if the
142 * string can be decoded into an integer value. The string may be an
146 * @param string
147 * a string representation of an integer value.
149 * {@code string}.
151 * if {@code string} cannot be parsed as an integer value.
153 public static Integer decode(String string) throws NumberFormatException {
154 int length = string.length(), i = 0;
156 throw invalidInt(string);
158 char firstDigit = string.charAt(i);
162 throw invalidInt(string);
164 firstDigit = string.charAt(++i);
172 if ((firstDigit = string.charAt(i)) == 'x' || firstDigit == 'X') {
174 throw invalidInt(string);
182 throw invalidInt(string);
187 int result = parse(string, i, base, negative);
218 * {@code string}. Returns {@code null} if {@code string} is {@code null}
222 * @param string
227 public static Integer getInteger(String string) {
228 if (string == null || string.length() == 0) {
231 String prop = System.getProperty(string);
244 * {@code string}. Returns the specified default value if {@code string} is
248 * @param string
256 public static Integer getInteger(String string, int defaultValue) {
257 if (string == null || string.length() == 0) {
260 String prop = System.getProperty(string);
273 * {@code string}. Returns the specified default value if {@code string} is
277 * @param string
285 public static Integer getInteger(String string, Integer defaultValue) {
286 if (string == null || string.length() == 0) {
289 String prop = System.getProperty(string);
321 * Parses the specified string as a signed decimal integer value. The ASCII
324 * @param string
325 * the string representation of an integer value.
326 * @return the primitive integer value represented by {@code string}.
328 * if {@code string} cannot be parsed as an integer value.
330 public static int parseInt(String string) throws NumberFormatException {
331 return parseInt(string, 10);
335 * Parses the specified string as a signed integer value using the specified
338 * @param string
339 * the string representation of an integer value.
342 * @return the primitive integer value represented by {@code string} using
345 * if {@code string} cannot be parsed as an integer value,
349 public static int parseInt(String string, int radix) throws NumberFormatException {
353 if (string == null) {
354 throw invalidInt(string);
356 int length = string.length(), i = 0;
358 throw invalidInt(string);
360 boolean negative = string.charAt(i) == '-';
362 throw invalidInt(string);
365 return parse(string, i, radix, negative);
368 private static int parse(String string, int offset, int radix, boolean negative) throws NumberFormatException {
370 int result = 0, length = string.length();
372 int digit = Character.digit(string.charAt(offset++), radix);
374 throw invalidInt(string);
377 throw invalidInt(string);
381 throw invalidInt(string);
388 throw invalidInt(string);
400 * Converts the specified integer into its binary string representation. The
401 * returned string is a concatenation of '0' and '1' characters.
405 * @return the binary string representation of {@code i}.
412 * Converts the specified integer into its hexadecimal string
413 * representation. The returned string is a concatenation of characters from
418 * @return the hexadecimal string representation of {@code i}.
425 * Converts the specified integer into its octal string representation. The
426 * returned string is a concatenation of characters from '0' to '7'.
430 * @return the octal string representation of {@code i}.
442 * Converts the specified integer into its decimal string representation.
443 * The returned string is a concatenation of a minus sign if the number is
448 * @return the decimal string representation of {@code i}.
455 * Converts the specified signed integer into a string representation based on the
456 * specified radix. The returned string is a concatenation of a minus sign
471 * @return the string representation of {@code i}.
478 * Parses the specified string as a signed decimal integer value.
480 * @param string
481 * the string representation of an integer value.
483 * represented by {@code string}.
485 * if {@code string} cannot be parsed as an integer value.
488 public static Integer valueOf(String string) throws NumberFormatException {
489 return valueOf(parseInt(string));
493 * Parses the specified string as a signed integer value using the specified
496 * @param string
497 * the string representation of an integer value.
501 * represented by {@code string} using {@code radix}.
503 * if {@code string} cannot be parsed as an integer value, or
508 public static Integer valueOf(String string, int radix) throws NumberFormatException {
509 return valueOf(parseInt(string, radix));