62,623
社区成员
发帖
与我相关
我的任务
分享
import java.io.*;
2
3public class test {
4 public static void main(String[] args) {
5 int a=0;
6 int b=1;
7 int c=2;
8 ByteArrayOutputStream bout = new ByteArrayOutputStream();
9 bout.write(a);
10 bout.write(b);
11 bout.write(c);
12 byte[] buff = bout.toByteArray();
13 for(int i=0; i<buff.length; i++)
14 System.out.println(buff[i]);
15 System.out.println("***********************");
16 ByteArrayInputStream bin = new ByteArrayInputStream(buff);
17 while((b=bin.read())!=-1) {
18 System.out.println(b);
19 }
20 }
21}