16進制字符串轉換成數字類型
public class Test {
public static void main(String[] args) {
String s = "0x40";
int b = Integer.parseInt(s.replaceAll("^0[x|X]", ""), 16);
System.out.println((char)b);
}
}
public static void main(String[] args) {
String s = "0x40";
int b = Integer.parseInt(s.replaceAll("^0[x|X]", ""), 16);
System.out.println((char)b);
}
}
posted on 2011-01-02 19:57 小一敗涂地 閱讀(1117) 評論(0) 編輯 收藏 所屬分類: java語言相關