שאלה בJAVA

cckuki

New member
שאלה בJAVA

שלום לכולם! יש לי שאלה למישהו שמבין, אני צריכה לתרגם string שני בתים בכל פעם לhex string כידוע מאוד מאוד איטי ופוגע קשות בביצועים אז ניסיתי להשתמש ב stringBuffer הבעיה היא שכדי לחתוך שני בתים בכל פעם אני צריכה להשתמש ב charAt ואני לא יודעת איך מסיבים את זה אח"כ לhex רעיונות?
 

shadowrunner

New member
אז ככה ...

first you do String str = "your string"; byte[] bytes; bytes = str.getBytes(); // and now you byte repesentation of string // now i am sure you know how to convert 2 bytes into hexadecimal
 
למעלה