I have written a method named byteArrayToHexString() which takes a byte array as parameter, and returns the Hexadecimal representation of the byte array. Below is the method.
public static String byteArrayToHexString(byte []input){
String string = "";
if(input == null){
return string;
}
for(byte b : input){
string += Integer.toHexString(Integer.parseInt(Byte.toString(b))).toUpperCase();
}
return string;
}
0 comments:
Post a Comment