The Integer class has a parse method that will convert a String to an int value. For a String with binary digits, use a radix of 2.

Also look at the Byte class's parse method.