44 public NumberFormatException () { 45 super(); 46 } 47 48 /** 49 * Constructs a <code>NumberFormatException</code> with the 50 * specified detail message. 51 * 52 * @param s the detail message. 53 */ 54 public NumberFormatException (String s) { 55 super (s); 56 } 57 58 /** 59 * Factory method for making a {@code NumberFormatException} 60 * given the specified input which caused the error. 61 * 62 * @param s the input causing the error 63 */ 64 static NumberFormatException forInputString(String s) { 65 return new NumberFormatException("For input string: \"" + s + "\""); 66 } 67 68 /** 69 * Factory method for making a {@code NumberFormatException} 70 * given the specified input which caused the error. 71 * 72 * @param s the input causing the error 73 * @param beginIndex the beginning index, inclusive. 74 * @param endIndex the ending index, exclusive. 75 * @param errorIndex the index of the first error in s 76 */ 77 static NumberFormatException forCharSequence(CharSequence s, 78 int beginIndex, int endIndex, int errorIndex) { 79 return new NumberFormatException("Error at index " 80 + (errorIndex - beginIndex) + " in: \"" 81 + s.subSequence(beginIndex, endIndex) + "\""); 82 } 83 } | 44 public NumberFormatException () { 45 super(); 46 } 47 48 /** 49 * Constructs a <code>NumberFormatException</code> with the 50 * specified detail message. 51 * 52 * @param s the detail message. 53 */ 54 public NumberFormatException (String s) { 55 super (s); 56 } 57 58 /** 59 * Factory method for making a {@code NumberFormatException} 60 * given the specified input which caused the error. 61 * 62 * @param s the input causing the error 63 */ 64 static NumberFormatException forInputString(String s, int radix) { 65 return new NumberFormatException("For input string: \"" + s + "\"" + 66 (radix == 10 ? 67 "" : 68 " under radix " + radix)); 69 } 70 71 /** 72 * Factory method for making a {@code NumberFormatException} 73 * given the specified input which caused the error. 74 * 75 * @param s the input causing the error 76 * @param beginIndex the beginning index, inclusive. 77 * @param endIndex the ending index, exclusive. 78 * @param errorIndex the index of the first error in s 79 */ 80 static NumberFormatException forCharSequence(CharSequence s, 81 int beginIndex, int endIndex, int errorIndex) { 82 return new NumberFormatException("Error at index " 83 + (errorIndex - beginIndex) + " in: \"" 84 + s.subSequence(beginIndex, endIndex) + "\""); 85 } 86 } |