private boolean parseBoolean(String s) {
        if ( "1".equals(s) ) {
            return true;
        } else if ( "0".equals(s) ) {
            return false;
        } else {
            throw new IllegalArgumentException("Expected 1 or 0 for boolean value, was " + s);
        }
    }
private boolean parseBoolean ( String s ) { if ( "1" . equals ( s ) ) { return true ; } else if ( "0" . equals ( s ) ) { return false ; } else { throw new IllegalArgumentException ( "Expected 1 or 0 for boolean value, was " + s ) ; } }
Attempts to parse the string given as a boolean and return its value.
Throws an exception if the value is anything other than 0 or 1.