그놈의 안드로이드
toHexString 본문
public static String toHexString(char[] letter){
StringBuffer sbHex = new StringBuffer();
for (int j = 0; j <letter.length; j++) {
String hexValue = Integer.toHexString(letter[j]);
sbHex.append(hexValue);
}
return sbHex.toString();
}
public static String toHexString(char ch){
String hexValue = Integer.toHexString(ch);
return hexValue;
}
public static String toHexString(byte b){
String hexValue = Integer.toHexString((int)b&0xff);
return hexValue;
}
public static String toHexString(byte[] letter){
return toHexString(letter, "");
}
public static String toHexString(byte[] letter, String split){
StringBuffer sbHex = new StringBuffer();
for (int j = 0; j <letter.length; j++) {
String hexValue = Integer.toHexString((int)letter[j]&0xff);
sbHex.append(formatData(hexValue.toUpperCase(), RIGHT, 2, '0')+split);
}
return sbHex.toString();
}
'개인코드' 카테고리의 다른 글
kotlin_Extension_코드 (0) | 2020.05.23 |
---|---|
hexStringToByteArray (0) | 2020.05.23 |