/
GermanezZ
/
JavaExercises
Обзор
Документация
Войти
/
GermanezZ
/
JavaExercises
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
AllMetanitLessons/InputOutoutStreamsFolder/ByteArray/InputByteArr.java
32 строки
674 B
germa
Уроки по Metanit
04 дек 2024, 20:39
04 дек 2024, 20:39
48d575a
Код
Авторство
О чём код?
package AllMetanitLessons.InputOutoutStreamsFolder.ByteArray; import java.io.ByteArrayInputStream; import java.io.IOException; public class InputByteArr { public static void main(String[] args) { String text = "Hi I'm German\n"; byte[] arr = text.getBytes(); ByteArrayInputStream bin = new ByteArrayInputStream(arr); int i; while ((i = bin.read())!=-1){ System.out.print((char) i); } byte[] barr = new byte[]{1,2,3,4,5,6,7,8,9}; ByteArrayInputStream binArr = new ByteArrayInputStream(barr); while ((i = binArr.read())!=-1){ System.out.print(i + "\t"); } } }