62,614
社区成员
发帖
与我相关
我的任务
分享
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class ByteArrayTester
{
public static void main(String agrs[]) throws IOException
{
byte[] buff = new byte[] { 2, 15, 67, -1, -9, 9, 100, 122 };
for (byte b : buff)
{
System.out.print(b + " ");
}
System.out.println();
ByteArrayInputStream in = new ByteArrayInputStream(buff, 1, 4);
int data = in.read();
while (data != -1)
{
System.out.print(data + " ");
data = in.read();
}
in.close();
}
}