char数组转为int数组

public class Test {
public static void main(String[] args){
char[] ch = {'3','5','2','4','0','8','1'};
int[] toInt = new int[ch.length];
for(int i=0;i<ch.length;i++){
toInt[i] = Integer.parseInt(String.valueOf(ch[i]));
System.out.print(toInt[i]);
}
}
}
补充:
valueOf用法:
static Integer valueOf(int i)
static Integer valueOf(String s)
static Integer valueOf(String s, int radix)
Integer.parseInt用法:
String转数字

全部评论

相关推荐

点赞 评论 收藏
分享
蔡徐kun:还行,早挂晚挂都是挂。早点挂进池子等别人捞你
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务