Parses the specified string as a signed decimal byte value. The ASCII character \u002d ('-') is recognized as the minus sign. @param string the string representation of a single byte value. @return the primitive byte value represented by string. @throws NumberFormatException
(String string)
| 188 | * can not be parsed as a byte value. |
| 189 | */ |
| 190 | public static byte parseByte(String string) throws NumberFormatException { |
| 191 | int intValue = Integer.parseInt(string); |
| 192 | byte result = (byte) intValue; |
| 193 | if (result == intValue) { |
| 194 | return result; |
| 195 | } |
| 196 | throw new NumberFormatException(); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Parses the specified string as a signed byte value using the specified |