자바 자릿수 char 배열을 int로 변환

1 개요[ | ]

public class MyClass {
    public static void main(String args[]) {
        char[] chs = {'1','2','3','4','5'};
        int num = 0;
        for(char ch: chs) { num *= 10; num += ch-'0'; }
        System.out.println( num );
        // 12345
    }
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}