25 lines
522 B
Java
25 lines
522 B
Java
package com.tarisan.util;
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
public class conversiones {
|
|
|
|
public static String toHexadecimal(String sData){
|
|
byte [] datos = sData.getBytes();
|
|
String resultado="";
|
|
ByteArrayInputStream input = new ByteArrayInputStream(datos);
|
|
String cadAux;
|
|
int leido = input.read();
|
|
while(leido != -1){
|
|
cadAux = Integer.toHexString(leido);
|
|
if(cadAux.length()<2){
|
|
resultado += "0";
|
|
}
|
|
resultado += cadAux;
|
|
leido = input.read();
|
|
}
|
|
return resultado.toUpperCase();
|
|
}
|
|
|
|
}
|