2016-08-01 2 views
-4

누구든지 아랍어 및 영어로 된 문자열에 대한 문자열을 16 진수 및 16 진수로 변환하는 데 도움을 줄 수 있습니까?문자열을 16 진수로 변환하고 그 반대로

String str = "مصطلحات : RAM : Random"; 
+2

가능한 중복 사용 [String으로 진수와 진수 문자열로 변환하는 방법?] (http://stackoverflow.com/questions/15020812/how -to-convert-string-to-hex-and-hex-to-string) – sinclair

답변

2
byte[] myBytes = "مصطلحات : RAM : Random".getBytes("UTF-8"); 
String hexString = DatatypeConverter.printHexBinary(myBytes); // to hex String 

byte[] bytes = Hex.decodeHex(hexString.toCharArray()); 
new String(bytes, "UTF-8"); // decode it back 

내가이 question와의 answer

+0

감사합니다 #Rudziankou 시도해 보겠습니다. –

관련 문제