Obrigado pela ajuda... agora eu consegui. public static int BinToDec(String bin){ int length_bin = 0, aux = 0, retorno = 0, i; length_bin = bin.length(); for (i=0;i<length_bin;i++) { aux = Integer.parseInt(bin.substring(i,i+1)); retorno += aux*(int)Math.pow(2,(length_bin-i))/2; } return(retorno); }