糖醋肉3984350
2016-10-13 21:42
public static void printHexByByteArray(String fileName)throws IOException{
FileInputStream in = new FileInputStream(fileName);
byte[] buf = new byte[20*1024];
int bytes = in.read(buf, 0, buf.length);
int j = 1;
for(int i=0;i<bytes;i++){
if(buf[i]<=0xf){
System.out.print("0");
}
System.out.print(Integer.toHexString(buf[i])+" ");
if(j++%10==0){
System.out.println();
}
}
}0ffffffca 0fffffffe 0ffffffba 0ffffffbe 00 00 00 34 00 34
知道了。。。没有&0xff。。。。
文件传输基础——Java IO流
133844 学习 · 1060 问题
相似问题