문자열 숫자 변환1 [Java] 정수를 문자열로 변환하기/int를 String으로 변환 Java에서 int와 long 데이터를 문자열로 바꾸는 방법에는 네 가지가 있다. 1. Integer.toString() Integer 클래스의 메소드이다. int형 파라미터 i를 입력받으면 문자열을 반환한다. public static String toString(int i) { int size = stringSize(i); if (COMPACT_STRINGS) { byte[] buf = new byte[size]; getChars(i, size, buf); return new String(buf, LATIN1); } else { byte[] buf = new byte[size * 2]; StringUTF16.getChars(i, size, buf); return new String(buf, UTF16).. 2022. 6. 13. 이전 1 다음