I have an array of Strings that represent Binary numbers (without leading zeroes) that I want to convert to their corresponding base 10 numbers. Consider:
bi
static int binaryToInt (String binary){ char []cA = binary.toCharArray(); int result = 0; for (int i = cA.length-1;i>=0;i--){ //111 , length = 3, i = 2, 2^(3-3) + 2^(3-2) // 0 1 if(cA[i]=='1') result+=Math.pow(2, cA.length-i-1); } return result; }