为什么不设定一个数组大小刚好的来读取文件呢?
File file=new File("imooc\\a.txt");
FileInputStream in=new FileInputStream(file);
byte[] byteArray=new byte[(int)file.length];
in.read(byteArray);
for(byte b:byteArray){
if(b>=0&&b<=0xf){
System.out.print("0");
}
System.out.print(Integer.toHexString(b&0xff)+" ");
}问一下 为什么不直接获取文件的长度来 创建byte数组?