package com.c2hex;
public class TestHex {
public static void main(String[] args) {
String aString=fourbu("34");
char[] char1= aString.toCharArray();
String binString="";
for(int i=0;i<char1.length;i++){
System.out.println(Integer.parseInt(char1[i]+""));
binString=binString+fourbu(Integer.toBinaryString(Integer.valueOf(char1[i]+"")) );
}
System.out.println(binString);
}
//4位2进制补0 32-->0032
public static String fourbu (String a){
String timesStr="";
for(int i=0;i<4-a.length();i++){
if(i==0){
timesStr="0"+a;
}else{
timesStr="0"+timesStr;
}
}
return timesStr;
}
// 去除0 0043--->43
public static String quling(String a){
return String.valueOf(Integer.valueOf(a));
}
}