How to can i convert hex value to string ? i get this weird result by using the following method.
for example :
String result = DB_record.convertHexToString(PASSWORD);
// c53255317bb11707d0f614696b3ce6f221d0e2f2 hex value;
System.err.println("result==="+result);
Java
public String convertHexToString(String hex){
StringBuilder sb = new StringBuilder();
StringBuilder temp = new StringBuilder();
for( int i=0; i<hex.length()-1; i+=2 ){
//grab the hex in pairs
String output = hex.substring(i, (i + 2));
//convert hex to decimal
int decimal = Integer.parseInt(output, 16);
//convert the decimal to character
sb.append((char)decimal);
temp.append(decimal);
}
return sb.toString();
}