例如:x=“5”
则返回:“12”
又例如:x=”F”
则返回:“120”
private static int getRealValue(char x)
{
if(x>=’0′ && x<=’9′) return x-‘0′;
if(x>=’a’ && x<=’f’) return x-‘a’+10;
if(x>=’A’ && x<=’F’) return x-‘A’+10;
return 0;
}
public static String jin_zhi_16_3(String x)
{
int n = 0; // 累加真值
for(int i=0; i<x.length(); i++)
{
n = n*16+ getRealValue(x.charAt(i)); // 填空
}
String t = “”;
for(;;)
{
if(n==0) break;
t = (n % 3) + t;
n=n/3; // 填空
}
return t;
}



