this is the code I have written but it gives incorrect answers and I can't figure out why
int decimal = 0;
int power= 0;
for(int i=0; i<binary.length; i++)
{
int tmp = binary[i]%10;
decimal+=tmp*Math.pow(2,power);
power++
}
System.out.println(decimal);