String和包装类型互相转换

1.String类型转换成包装类

     Double aDouble = Double.valueOf("12.66");//返回Double包装类型
        double aDouble1 = Double.parseDouble("12.66");//返回double基本数据类型

        Long aLong = Long.valueOf("123456");//返回Long包装类型
        long parseLong = Long.parseLong("123456");//返回long基本数据类型

        Integer integer = Integer.valueOf("123");///返回Integer包装类型
        int i = Integer.parseInt("123");//返回int基本数据类型

  

2.基本转换成String类型

        String s = Integer.toString(100);

        String s1 = Long.toString(10000);

        String s2 = Double.toString(26.66);

  

原文地址:https://www.cnblogs.com/Amywangqing/p/13641146.html