public static void main(String[] args) {
String str = "000AB";
Integer in = Integer.valueOf(str,16);
String st = Integer.toHexString(in).toUpperCase();
st = String.format("%5s",st);
st= st.replaceAll(" ","0");
}
原文:http://www.cnblogs.com/flycoding/p/6110635.html