在java里面对数值而言,
十六进制转化为十进制是可以直接赋值的
运行下面代码看看就知道了:
int i = 0x80010001;//16进制
System.out.println(i);

解决方案 »

  1.   

    但是如果把4F.3AH转化为十进制怎么办啊?你上面说的那个,我运行了一下,结果是-2147418111。但我意思是想把任何一个十六进制的转换为十进制啊。麻烦您再告诉我好吗?多写点,谢谢。
      

  2.   

    参考java.lang.Long.decode(String nm) 
    Decodes a String into a Long. Accepts decimal, hexadecimal, and octal numbers given by the following grammarLong l1 = java.lang.Lang.decode("0x11");
      

  3.   

    //下面的代码我用jdk1.4试了一下
    public class Hex
    {
    public static float decode(String hexNum)
    {
    int n;
    n=hexNum.indexOf(".");
    if(n==-1)
    {
    float zs=Integer.decode("0x"+hexNum).floatValue();
    return zs;
    }
    else
    {
    String Z,F;
    int m=hexNum.length()-n-1;
        Z=hexNum.substring(0,n);
        F=hexNum.substring(n+1,hexNum.length());
        float z=Integer.decode("0x"+Z).floatValue();
        float f=Integer.decode("0x"+F).floatValue();
        f=(float)(f/Math.pow(16,m));
        return z+f;
     }
    }

       public static void main(String argv[])
       {
          System.out.println(decode("4F.3A"));
       }
    }