Transformar string em hexa ...[RESOLVIDO]

2 respostas
j.silvestre

Bom dia

tenho uma String

String teste = "CCD4C5D3D4C5"

a cada 2 caracter tenho que tranforma em um byte exempo:

“CC” em (byte) 0xCC
“D4” em (byte) 0xD4

e assim por diante.

sds

j.silvestre

2 Respostas

E

http://docs.oracle.com/javase/6/docs/api/java/lang/Integer.html#parseInt(java.lang.String,%20int)

Exemplo:

byte b = (byte) Integer.parseInt ("CC", 16);
j.silvestre

Valeu

entanglement .

sds

j.silvestre

Criado 29 de janeiro de 2013
Ultima resposta 29 de jan. de 2013
Respostas 2
Participantes 2