You need to specify the radix. There’s an overload of Integer#parseInt() which allows you to.
int foo = Integer.parseInt(“1001”, 2);
This might work:
public int binaryToInteger(String binary) {
char[] numbers = binary.toCharArray();
int result = 0;
for(int i=numbers.length – 1; i>=0; i–)
if(numbers[i]==’1′)
result += Math.pow(2, (numbers.length-i – 1));
return result;
}