porky
#1
Boas people, tenho a seguinte duvida
tenho uma matriz 3x3
a matriz tem numeros binarios
0000 1111 1111
1010 1110 1110
1001 0011 0100
eu quero converter todos eles para decimal
e ficar assim:
0 15 15
10 14 14
9 3 4
Alguem me pode ajudar?
Agradecia 
thingol
#2
Uai, sua matriz não contém números binários; ela contém apenas números. Vou dar um exemplo:
class Teste {
/**
0000 1111 1111
1010 1110 1110
1001 0011 0100
*/
public static void main(String[] args) {
int matriz[][] = {
{Integer.parseInt ("0000", 2), Integer.parseInt ("1111", 2), Integer.parseInt ("1111", 2)},
{Integer.parseInt ("1010", 2), Integer.parseInt ("1110", 2), Integer.parseInt ("1110", 2)},
{Integer.parseInt ("1001", 2), Integer.parseInt ("0011", 2), Integer.parseInt ("0100", 2)}
};
for (int i = 0; i < 3++i) {
for (int j = 0; j < 3; ++j) {
System.out.print (matriz[i][j] + " ");
}
System.out.println ();
}
}
}
porky
#3
perfeito
Funciona obrigado 