public static final boolean parseBoolean ( CharSequence cs , int radix , int beginIndex , int endIndex ) { if ( radix != 2 ) { throw new IllegalArgumentException ( "radix must be 2" ) ; } if ( Character . codePointCount ( cs , beginIndex , endIndex ) != 1 ) { throw new IllegalArgumentException ( "input length must be 1" ) ; } int digit = Character . digit ( Character . codePointAt ( cs , beginIndex ) , 2 ) ; switch ( digit ) { case 1 : return true ; case 0 : return false ; default : throw new IllegalArgumentException ( "input must be 0/1" ) ; } }
Parses the char sequence argument as a boolean . The boolean returned represents the value true if the char sequence argument is not null and it s digit value is 1 .