private static final boolean checkByte ( String s ) throws AttributeBadValueException { try { // Byte.parseByte() can't be used because values > 127 are allowed short val = Short . parseShort ( s ) ; if ( DebugValueChecking ) { log . debug ( "Attribute.checkByte() - string: '" + s + "' value: " + val ) ; } if ( val > 0xFF || val < 0 ) return false ; else return true ; } catch ( NumberFormatException e ) { throw new AttributeBadValueException ( "`" + s + "' is not a Byte value." ) ; } }
Check if string is a valid Byte .