protected static int getValueByBinStr ( String binaryString , boolean signed ) { Integer value = Integer . parseInt ( binaryString , 2 ) ; if ( signed && binaryString . charAt ( 0 ) == ' ' ) { char [ ] invert = new char [ binaryString . length ( ) ] ; Arrays . fill ( invert , ' ' ) ; value ^= Integer . parseInt ( new String ( invert ) , 2 ) ; value += 1 ; value = - value ; } return value ; }
Get a value for specified bits from the binary string .