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