以下代码读取了文件后,整个console里输出的都是68,但这个文件里只有5个字节(hello),求大神解答是何原因?
package com.imooc;
import java.io.FileInputStream;
import java.io.IOException;
public class IOUtil {
/*
*
*/
public static void printHex(String fileName)throws IOException{
FileInputStream in=new FileInputStream(fileName);
int b=in.read();
int i=1;
while(b!=-1){
if(b<=0xf){
System.out.println();
}
System.out.print(Integer.toHexString(b)+" ");
if(i++%10==0){
System.out.println();
}
}
in.close();
}
public class Text {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
IOUtil.printHex("C:\\Users\\dell\\Desktop\\io.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}