I converted a byte array into string by doing
String s = encryptedBytes1.toString();
String gh = convertStringToHex(s);
Then I printed on screen gh
which is the hex form it returned this:
gh:[B@5985910
this is the function convert
public static String convertStringToHex(String str){
char[] chars = str.toCharArray();
StringBuffer hex = new StringBuffer();
for(int i = 0; i < chars.length; i++){
hex.append(Integer.toHexString((int)chars[i]));
}
return hex.toString();
}
Can any one help me printing the hex form string?