我是靠谱客的博主 野性哑铃,这篇文章主要介绍Integer 和 BigDecimal 转换基本类型转换一、String 转 int二、 对象数据类型 转 String三、Integer 和 BigDecimal 转换四、 BigDecimal 和 Integer 转换,现在分享给大家,希望可以做个参考。
基本类型转换
一、String 转 int
String str = "123"
int count = Integer.parseInt(str);
二、 对象数据类型 转 String
Integer num = 123;
String str = num.toString();
三、Integer 和 BigDecimal 转换
Integer num = "123";
new BigDecimal( Integer.parseInt ( num.toString() ) );
四、 BigDecimal 和 Integer 转换
// 第一步:先将BigDecimal转换为String类型
BigDecimal a = new BigDecimal(1);
String str = a.toString();
// 第二步:再将String类型转换为Integer类型
Integer integer = Integer.parseInt(str);
最后
以上就是野性哑铃最近收集整理的关于Integer 和 BigDecimal 转换基本类型转换一、String 转 int二、 对象数据类型 转 String三、Integer 和 BigDecimal 转换四、 BigDecimal 和 Integer 转换的全部内容,更多相关Integer内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复